Skip to content

Instantly share code, notes, and snippets.

@wparad
Created November 22, 2018 19:06
Show Gist options
  • Save wparad/b730d7d0b03d8e2158c0589502aa29af to your computer and use it in GitHub Desktop.
Save wparad/b730d7d0b03d8e2158c0589502aa29af to your computer and use it in GitHub Desktop.
{ "from": 0,
"size": 100,
"version": true,
"sort": [
{
"_script": {
"order": "desc",
"type": "string",
"script": {
"lang": "painless",
"source": "if (!doc.containsKey('sortableKey.keyword')) { return ''; } for (int i = 0; i < doc['sortableKey.keyword'].length; ++i) { if (doc['sortableKey.keyword'][i].contains('StringThingToSearch')) { return doc['sortableKey.keyword'][i]; } } return '';"
}
}
}
],
"query": {
"bool": {
"must": [
{
"terms": {
"identitifier.id": [
"Id"
]
}
},
{
"range": {
"status.new.quantity": {
"gte": 1.0
}
}
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment