I've been trying out the geo_distance query on the latest version of Elasticsearch (6.6), but it seems I always get hits/results back. If I follow the example here and change either the latitude/longitude to something way off with a distance of 1 km, I'm still getting hits back.
What is a typical result you are getting you should not get back?
Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.
A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.
Thanks for the fast response! The reproduction script is in your documentation in the link in my previous post... I can copy/paste it here if you'd like though for completeness later on?
I expect to not get any results back if I'm specifying a distance with a latitude/longitude outside of the given data set. As I mentioned in my previous post, if I'm at a longitude/latitude of 30/0 with a 1 kilometer distance, I definitely shouldn't be returning a point back with a latitude of 40.12 and longitude -71.34... that's significantly further away than 1 km...
I noticed yours doesn't have a "_doc" key in the payload for the mappings.. is this a caveat of 7.0.0-beta1 for you? If I try this on 6.6.1 it returns a 400 with the error message:
Are there any additional tweaks/plugins/things I have to have installed in my Elasticsearch instance? I'm trying to figure out what we're doing differently here.
Figured it out! This is an issue with the REST client I'm using (Paw from https://paw.cloud). Apparently, it's stripping out the body on GET requests. When I tried the above with Postman, it sent the payload and got the response correctly. Thanks for the help @dadoonet!!
For other people that hit this problem with Paw, here's how you enable the payload on any request:
You should have tell me from the start.
Actually Kibana transforms GET with body to POST requests as many browsers if not all do not support GET with a body.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.