Abhishek Adhikary
Abhishek Adhikary

Reputation: 11

Mapping definition for [location] has unsupported parameters: [geohash : true] : Elasticsearch 5.X

I'm using elasticsearch 5.2, but when setting up index mapping with [geohash:true] for a geo_point field I'm getting the following error

{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "Mapping definition for [location] has unsupported parameters:  [geohash : true]"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "Failed to parse mapping [jdloc]: Mapping definition for [location] has unsupported parameters:  [geohash : true]",
    "caused_by": {
      "type": "mapper_parsing_exception",
      "reason": "Mapping definition for [location] has unsupported parameters:  [geohash : true]"
    }
  },
  "status": 400
}

Can anyone tell me if [geoshash] has been depreciated or there is another way to generate and store geohash from geo_point field type while creating documents?

Upvotes: 1

Views: 3938

Answers (1)

Rajind Ruparathna
Rajind Ruparathna

Reputation: 2255

Quoting the documentation,

geo_point fields

Like Numeric fields the Geo point field now uses the new BKD tree structure. Since this structure is fundamentally designed for multi-dimension spatial data, the following field parameters are no longer needed or supported: geohash, geohash_prefix, geohash_precision, lat_lon. Geohashes are still supported from an API perspective, and can still be accessed using the .geohash field extension, but they are no longer used to index geo point data.

Looks like it is no longer supported/needed. See here. According to the example they use geohash with following mapping.

{
  "mappings": {
    "my_type": {
      "properties": {
        "location": {
          "type": "geo_point"
        }
      }
    }
  }
}

 PUT my_index/my_type/3
{
  "text": "Geo-point as a geohash",
  "location": "drm3btev3e86" 
}

UPDATE:

What I understand from the documentation is that geohash is not supported in mapping but you can still access it. So it should be calculated automatically.

Therefore when you index as follows, you should be able to access geohash as well.

PUT my_index/my_type/1
{
  "text": "Geo-point as an object",
  "location": { 
    "lat": 41.12,
    "lon": -71.34
  }
}

Upvotes: 3

Related Questions