Geographical objects and shapes are supported in ES through these field types:
- GEO POINTS → latitude/longitude pairs or geo hashes. Primarily used for:
- finding locations within a bounding box, within a certain distance of a central point, within a polygon, or within a geo_shape query
- integrating distance into a document’s relevance score
- and sorting documents by distance.
geo_shapedocuments using the spatial relations
- SHAPES → arbitrary
x, ycartesian shapes Only available within X-Pack — a closed-source collection of features that's part of an official Elasticsearch Subscription.
The third dimension (z-value) in any of the above field types is also accepted but only the latitude and longitude values will be indexed — the third dimension is ignored!
People often ask how many coordinate decimal places they should store.
- Accuracy is the tendency of your measurements to agree with the true values.
- Precision is the degree to which your measurements pin down an actual value.
I'm not going to get into the accuracy part and will rather focus on precision — here's a summary of what each digit in a decimal degree signifies:
- The sign tells us whether we are north or south, east or west on the globe (+ N/E, - S/W).
- A nonzero hundreds digit tells us we're using longitude, not latitude! See below — the x-axis represents the longitude, the y-axis the latitude:
North (+90) | | (-180) West ---+--- East (+180) | | South (-90)