I'd like to return documents using the geoshape query, but I'm having trouble deciding which spatial relation to use. The document has a location as a geopoint. I will be searching by providing a polygon. Should I use the default intersects
or should I use within
? What are the differences in regards to searching geopoints (if any)? Which is more performant?
This is my mapping
{
"mappings": {
"properties": {
"location": {
"type": "geo_point",
"index": true
}
}
}
}
Here is a sample query
{
"query": {
"bool": {
"filter": [
{
"geo_shape": {
"location": {
"shape": {
"type": "polygon",
"coordinates": [
[
[
-121.79854,
37.29158
],
[
-121.79562,
37.29178
],
[
-121.79592,
37.28953
],
[
-121.79847,
37.28984
],
[
-121.79854,
37.29158
]
]
]
},
"relation": "intersects"
}
}
}
]
}
}
}