Geo Distance Query - Exception-query_shard_exception, reason:Failed to parse query [SOLVED]


(Rahul Lao) #1

Hi,

Please can someone suggest what's wrong in below query when i type this in kibana search bar

"query":{"bool":{"must":{"match_all":{}},"filter":{"geo_distance":{"distance":"20km","location":{"lon":-23.965,"lat":65.555801}}}}}

Sample documents that i have indexed are

country:Iceland altitude:11 iato:PFJ airport_id:17 dst:N city:Patreksfjordur timezone:0 tz:Atlantic/Reykjavik source:OurAirports type:airport path:/home/vagrant/dataset/airports.csv @timestamp:May 16th 2017, 12:41:26.791 @version:1 name:Patreksfjörður Airport icao:BIPA location:{ "lon": -23.965, "lat": 65.555801 } _id:AVwQ2SvNCj46ZjiRHCsh _type:airport _index:flights_dataset _score:1

country:Papua New Guinea altitude:19 iato:WWK airport_id:6 dst:U city:Wewak timezone:10 tz:Pacific/Port_Moresby source:OurAirports type:airport path:/home/vagrant/dataset/airports.csv @timestamp:May 16th 2017, 12:41:26.747 @version:1 name:Wewak International Airport icao:AYWK location:{ "lon": 143.669006348, "lat": -3.58383011818 } _id:AVwQ2SvKCj46ZjiRHCsg _type:airport _index:flights_dataset _score:1

country:Iceland altitude:8 iato:IFJ airport_id:15 dst:N city:Isafjordur timezone:0 tz:Atlantic/Reykjavik source:OurAirports type:airport path:/home/vagrant/dataset/airports.csv @timestamp:May 16th 2017, 12:41:26.769 @version:1 name:Ísafjörður Airport icao:BIIS location:{ "lon": -23.135299682617188, "lat": 66.05809783935547 } _id:AVwQ2Sv-Cj46ZjiRHCsv _type:airport _index:flights_dataset _score:1

country:Canada altitude:108 iato:YAY airport_id:24 dst:A city:St. Anthony timezone:-3.5 tz:America/St_Johns source:OurAirports type:airport path:/home/vagrant/dataset/airports.csv @timestamp:May 16th 2017, 12:41:27.106 @version:1 name:St. Anthony Airport icao:CYAY location:{ "lon": -56.083099365200006, "lat": 51.3918991089 } _id:AVwQ2SyxCj46ZjiRHCsy _type:airport _index:flights_dataset _score:1

Looking forward for reply.
Thanks


(Rahul Lao) #2

Found the mistake.
The correct one should be

{"bool":{"must":{"match_all":{}},"filter":{"geo_distance":{"distance":"20km","location":{"lon":-23.965,"lat":65.555801}}}}}


(Felix Stürmer) #3

Glad to hear you figured it out. Thanks for sharing your solution with the community!


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.