Skip to content

Instantly share code, notes, and snippets.

@rjbaker
Created January 25, 2016 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjbaker/9a9666d17ac9a55ac5b7 to your computer and use it in GitHub Desktop.
Save rjbaker/9a9666d17ac9a55ac5b7 to your computer and use it in GitHub Desktop.
ES Collator Query
{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"and": [
{
"nested": {
"path": "locations",
"inner_hits": {},
"query": {
"filtered": {
"filter": {
"and": [
{
"geo_shape": {
"locations.region": {
"shape": {
"type": "Circle",
"radius": 20000,
"coordinates": [
-122.8061676,
38.8328323
]
}
}
}
},
{
"nested": {
"path": "locations.settings",
"query": {
"filtered": {
"filter": {
"and": [
{
"term": {
"locations.settings.event": 50
}
},
{
"term": {
"locations.settings.notify": true
}
},
{
"range": {
"locations.settings.severity": {
"lte": 0.43
}
}
}
]
}
}
}
}
}
]
}
}
}
}
},
{
"nested": {
"path": "devices",
"query": {
"filtered": {
"filter": {
"and": [
{
"exists": {
"field": "devices.arn"
}
},
{
"exists": {
"field": "devices.system"
}
}
]
}
}
}
}
}
]
}
}
},
"from": 0,
"size": 5,
"_source": {
"include": [
"devices"
]
},
"sort": [
{
"devices.system": {
"order": "asc",
"nested_path": "devices"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment