Skip to content

Instantly share code, notes, and snippets.

@zouzias
Created March 29, 2017 06:36
Show Gist options
  • Save zouzias/131d015e19c04af023d5cb21c3e7a410 to your computer and use it in GitHub Desktop.
Save zouzias/131d015e19c04af023d5cb21c3e7a410 to your computer and use it in GitHub Desktop.
Examples of Elasticsearch's geo_shape queries
{ "query":
{ "bool" : {
"must" : {
"match_all" : {}
},
"filter": {
"geo_shape": {
"coords": {
"shape": {
"type": "circle",
"radius": "20km",
"coordinates": [7.439065, 46.948872]
}
}
}
}
}
}
}
{
"type": {
"dynamic": "strict",
"_all": {
"enabled": false
},
"properties": {
"id" :{
"type": "string"
},
"coords": {
"type": "geo_shape",
"tree": "quadtree",
"precision": "10m"
}
}
}
}
{ "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