2017-02-22 106 views
0

我正在使用elasticsearch 5.2,但是當爲geo_point字段I'設置[geohash:true] m到處以下錯誤[位置]的映射定義具有不受支持的參數:[geohash:true]:Elasticsearch 5.X

{ 
    "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 
} 

誰能告訴我,如果[geoshash]現在已經貶值或有在創建文件的另一種方式產生,並從geo_point字段類型店面地理散列?

回答

1

引述documentation

geo_point領域

像數字字段的地理點場現在使用 新BKD樹結構。由於此結構基本上是針對多維空間數據設計的 ,因此不再需要或不支持以下字段參數 :geohash,geohash_prefix, geohash_precision,lat_lon。 Geohashes仍然支持從API 的角度來看,仍然可以使用擴展名.geohash字段 進行訪問,但它們不再用於索引地理點數據。

看起來不再支持/需要。見here。根據示例,他們使用geohash以及以下映射。

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

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

UPDATE:

我從文檔不解的是,geohash不支持映射,但您仍可以訪問它。所以應該自動計算。

因此,當您索引如下時,您應該也可以訪問geohash

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

這類似於從使用另一個源和儲存它明確elasticsearch生成地理散列。但是我需要從存儲的經緯度格式化geo_points自動生成geohash。 –

+0

@AbhishekAdhikary查看更新的答案 –

相關問題