city.location was an example ;)
You should use yours.

Le mercredi 30 juillet 2014 18:13:53 UTC+2, Madhavan Ramachandran a écrit :
>
> Nope.. it did not work..got exception as 
> QueryParsingException[[offlocations_geo] failed to find geo_point field 
> [city.location
>
> Regards
> Madhavan.TR
> On Wednesday, July 30, 2014 10:08:45 AM UTC-5, Joffrey Hercule wrote:
>>
>> Hi !
>> Use  "query".
>>
>> ex :
>> {
>>   "query" : {
>>     "filtered" : {
>>         "query" : {
>>             "match_all" : {}
>>         },
>>         "filter" : {
>>             "geo_distance" : {
>>                 "distance" : "50km",
>>                 "city.location" : {
>>                     "lat" : 43.4,
>>                     "lon" : 5.4
>>                 }
>>             }
>>         }
>>     }
>>   }
>> }
>>
>> Le mardi 29 juillet 2014 22:30:12 UTC+2, Madhavan Ramachandran a écrit :
>>>
>>> Hi Team,
>>>
>>> I am trying to find a solution for the below
>>>
>>>    1. Geo boundary based search.. My index have property for lat and 
>>>    lon as double.. not as a geopoint.. Here is my mapping for my index..
>>>
>>> How do i use the lon and lat from the below mapping for geo distance 
>>> filter/geo distance range filter ?
>>>
>>> Name Type Format Store?
>>> data string
>>>
>>> getpath string
>>>
>>> id double
>>>
>>> Region string
>>>
>>> Submarket string
>>>
>>> addr1 string
>>>
>>> addr2 string
>>>
>>> city string
>>>
>>> citymarket string
>>>
>>> country string
>>>
>>> countryid long
>>>
>>> cultureid long
>>>
>>> data string
>>>
>>> details string
>>>
>>> fax string
>>>
>>> id string
>>>
>>> language string
>>>
>>> lat double
>>>
>>> lon double
>>>
>>> When I search for the documents.. i got the below exception..
>>>
>>> Query : 
>>> {
>>> "filter": {
>>> "geo_distance" : {
>>> "distance" : "300km",
>>> "location" : {
>>> "lat" : 45,
>>> "lon" : -122
>>> }
>>> }
>>>
>>> }
>>> }
>>>
>>> Exception: 
>>> "error": "SearchPhaseExecutionException[Failed to execute phase [query], 
>>> all shards failed; shardFailures 
>>> {[o3f66HetT3OSpVw895w0nA][offlocations][4]: 
>>> SearchParseException[[offlocations][4]: from[-1],size[-1]: Parse Failure 
>>> [Failed to parse source [{\n\"filter\": {\n \"geo_distance\" : {\n 
>>> \"distance\" : \"300km\",\n \"location\" : {\n \"lat\" : 45,\n \"lon\" : 
>>> -122\n }\n } \n }\n}]]]; nested:
>>>
>>> I tried with removing the location, which i dont have in my mapping.. 
>>>
>>> {"filter": {     "geo_distance" : {             "distance" : "300km",    
>>> "lat" 
>>> : 45, "lon" : -122       }  }}
>>>
>>> I got the exception as lon is not a geo_point field..
>>>
>>> ElasticsearchIllegalArgumentException[the character '-' is not a valid 
>>> geohash character]; }]"
>>>
>>> If i remove the "-" infront of lon.. then the exception says : 
>>>
>>> QueryParsingException[[offlocations] field [lon] is not a geo_point 
>>> field];
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/a95b2a60-6f4d-4727-9b38-67cfd4329465%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to