php - ElasticSearch geo_distance filter is not returning any hits -
I am using ElasticSearch (1.4.0) to execute my search.
I'm able to set up flexible search and everything works great except for the geo_location filter.
Every time I use the geo_location filter, no results return. Note that elastic search does not return any errors, not just a hit returned, even if I made sure that my search point has nearby institutions.
This is a simplified version of my PHP parametric array that I am using to test the geo-distance filter:
$ searchParams ['index'] = 'Myname'; $ Search perm ['type'] = 'mindity'; $ Search perm ['body'] ['query'] ['filter'] ['filter'] ['geographic_distance'] = ['distance' = & gt; '50km', 'address.geopoint' = & gt; $ Latitude "," $ Lng]; And this is the curl request body that does not return any hits:
{"query": {"filtered": {"filter ": {" Geo_distance ": {" Distance ":" 50km "," address.geopoint ":" 51.43, -2.54 "}}}}} This is my mapping: {"Myname": {"myentity": {"property": {"address": {"type": "nested", "property": {"country": "" "{" Type ":" string "}," geopoint ": {" type ":" geo_point "," lat_lon ": true}," house ": {" type ":" string "}," postcode ": {" Ty { "Type": "string"}}}, "categories": {"type": "string": "string"}, "street": {"type": "string"}, "city"}, "tag ": {" Type ":" string "}}}}}}
here is a document I expect to get hit as:
[_ source] => Array ([Categories] => Array () [Tag] = & gt; Array () [Address] = & gt; Array ([road] = & gt; Bristol Road [GOPAT] => 51.4307381, - 2.5417914 [City] = Bristol [Home] => 1 [Postcode] => BS 4 5 NL [country] => UK)) No Also help would be appreciated.
According to:
in the format [LAN, latitude] Note, the order
then I think you should try:
Edit: Answer after your version Since you have posted your mapping, now I see your real problem. As you are using for the This is either or stop using the nested type (if I am not mistaken, then it will change from your mapping to address.coordinates = [$ lng, $ lat]
address object, you need to do the following:
{"query": {"nested": {"path" : "Address", "query": {"filtered": {"filter": {"geo_distance": {"distance": "50km", "geopoint": "51.43, -2.54"}}}}}}} "type": "nested", Is being removed). In this particular use case it is not really necessary and your original work will be done.
Comments
Post a Comment