Created
March 29, 2017 06:36
-
-
Save zouzias/131d015e19c04af023d5cb21c3e7a410 to your computer and use it in GitHub Desktop.
Examples of Elasticsearch's geo_shape queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ "query": | |
{ "bool" : { | |
"must" : { | |
"match_all" : {} | |
}, | |
"filter": { | |
"geo_shape": { | |
"coords": { | |
"shape": { | |
"type": "circle", | |
"radius": "20km", | |
"coordinates": [7.439065, 46.948872] | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": { | |
"dynamic": "strict", | |
"_all": { | |
"enabled": false | |
}, | |
"properties": { | |
"id" :{ | |
"type": "string" | |
}, | |
"coords": { | |
"type": "geo_shape", | |
"tree": "quadtree", | |
"precision": "10m" | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ "query": | |
{ "bool" : { | |
"must" : { | |
"match_all" : {} | |
}, | |
"filter": { | |
"geo_shape": { | |
"coords": { | |
"shape": { | |
"type": "polygon", | |
"coordinates" :[[ | |
[8.535725, 47.370196], | |
[8.540574, 47.372510], | |
[8.545724, 47.372499], | |
[8.549114, 47.368477], | |
[8.536840, 47.364949], | |
[8.535725, 47.370196]]] | |
}, | |
"relation": "within" | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment