0
我一直在遇到這個問題,我得到failed to find geo_point field [location]
如何在elasticsearch中將位置設置爲geo_point?
這是我的流程。
導入CSV
input { file { path => "test.csv" start_position => "beginning" sincedb_path => "/dev/null" } } filter { csv { separator => "," #zip,lat, lon columns => [ "zip" , "lat", "lon"] } mutate { convert => { "zip" => "integer" } convert => { "lon" => "float" } convert => { "lat" => "float" } } mutate { rename => { "lon" => "[location][lon]" "lat" => "[location][lat]" } } mutate { convert => { "[location]" => "float" } } } output { elasticsearch { hosts => "cluster:80" index => "data" } stdout {} }
測試記錄
GET data "hits": [ { "_index": "data", "_type": "logs", "_id": "AVvQcOfXUojnX", "_score": 1, "_source": { "zip": 164283216, "location": { "lon": 71.34, "lat": 40.12 } } }, ...
如果我嘗試運行geo_distance
查詢我得到failed to find geo_point field [location]
然後我嘗試運行
PUT data
{
"mappings": {
"location": {
"properties": {
"pin": {
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
}
}
}
,但我得到index [data/3uxAJ4ISKy_NyVDNC] already exists
如何轉換我到location
一個geo_point
這樣我就可以在其上運行的查詢?
編輯:
我想我的索引東西之前種植的模板,但還是同樣的錯誤
PUT _template/template
{
"template": "base_map_template",
"order": 1,
"settings": {
"number_of_shards": 1
},
"mappings": {
"node_points": {
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
}
做到了。謝謝。 – Patrioticcow
很酷,很高興它幫助! – Val