Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ElasticSearch QueryParsingException failed to find geo_point field

Trying to build search as follows:

{
  "query": {
    "filtered": {
      "query": {
        "match_all": {}
      },
      "filter": {
        "geo_distance": {
          "distance": "50km",
          "coordinates": {
            "lat": 52.5234051,
            "lon": 4.113999
          }
        }
      }
    }
  }
}

where coordinates is of type 'geo_point'.

But when I try to run this query, the elasticsearch.log pops up with an error: [locations] failed to find geo_point field [coordinates]

Edit:

This is part of the /locations/location/_mapping:

{
  "locations": {
  "mappings": {
  "location": {
  "properties": {
    ...
    "coordinates": {
      "properties": {
        "lat": {
          "type": "string"
         },
        "lon": {
          "type": "string"
        }
      }
    },
   ...
 }
}

Any ideas what is wrong here?

like image 869
axel freudiger Avatar asked May 12 '14 14:05

axel freudiger


1 Answers

The problem is mapping.you need to use geo_point in mapping.. refer this .

like image 115
BlackPOP Avatar answered Oct 26 '22 15:10

BlackPOP