ElasticSearch 5.0.0 - 关于对象名称的错误已在使用中
ElasticSearch 5.0.0 - error about object name is already in use
我正在学习 ElasticSearch 并且遇到了障碍。我正在尝试使用 logstash 将简单的 CSV 加载到 ElasticSearch 中。这是数据,是邮编,经度,纬度
ZE1 0BH,-1.136758103355,60.150855671143
ZE1 0NW,-1.15526666950369,60.1532197533966
我正在使用以下 logstash conf 文件来过滤 CSV 以创建 "location" 字段
input {
file {
path => "postcodes.csv"
start_position => "beginning"
sincedb_path => "/dev/null"
}
}
filter {
csv {
columns => ["postcode", "lat", "lon"]
separator => ","
}
mutate { convert => {"lat" => "float"} }
mutate { convert => {"lon" => "float"} }
mutate { rename => {"lat" => "[location][lat]"} }
mutate { rename => {"lon" => "[location][lon]"} }
mutate { convert => { "[location]" => "float" } }
}
output {
elasticsearch {
action => "index"
hosts => "localhost"
index => "postcodes"
}
stdout { codec => rubydebug }
}
并且我已经使用 Kibana 中的控制台将映射添加到 ElasticSearch
PUT postcodes
{
"settings": {
"number_of_shards": 1
},
"mappings": {
"feature": {
"_all": { "enabled": true },
"properties": {
"postcode": {"type": "text"},
"location": {"type": "geo_point"}
}
}
}
}
我使用
检查索引的映射
GET postcodes/_mapping
{
"postcodes": {
"mappings": {
"feature": {
"_all": {
"enabled": true
},
"properties": {
"location": {
"type": "geo_point"
},
"postcode": {
"type": "text"
}
}
}
}
}
}
因此,在查看文档和发布的其他问题后,这一切似乎都是正确的。
然而当我运行
bin/logstash -f postcodes.conf
我得到一个错误:
[location] is defined as an object in mapping [logs] but this name is already used for a field in other types
我尝试了很多替代方法;
删除了索引并创建了 template.json 并更改了我的 conf 文件以具有额外的设置:
manage_template => true
template => "postcode_template.json"
template_name =>"open_names"
template_overwrite => true
这会得到同样的错误。
我已经设法通过不提供模板来加载数据,但是数据永远不会作为 geo_point 加载,因此您无法使用 Kibana Tile Map 来可视化数据
谁能解释为什么我会收到该错误以及我应该使用什么方法?
您的问题是您的 elasticsearch
输出中没有 document_type => feature
。否则,它将在 logs
类型上创建对象,这就是您遇到此冲突的原因。
我正在学习 ElasticSearch 并且遇到了障碍。我正在尝试使用 logstash 将简单的 CSV 加载到 ElasticSearch 中。这是数据,是邮编,经度,纬度
ZE1 0BH,-1.136758103355,60.150855671143
ZE1 0NW,-1.15526666950369,60.1532197533966
我正在使用以下 logstash conf 文件来过滤 CSV 以创建 "location" 字段
input {
file {
path => "postcodes.csv"
start_position => "beginning"
sincedb_path => "/dev/null"
}
}
filter {
csv {
columns => ["postcode", "lat", "lon"]
separator => ","
}
mutate { convert => {"lat" => "float"} }
mutate { convert => {"lon" => "float"} }
mutate { rename => {"lat" => "[location][lat]"} }
mutate { rename => {"lon" => "[location][lon]"} }
mutate { convert => { "[location]" => "float" } }
}
output {
elasticsearch {
action => "index"
hosts => "localhost"
index => "postcodes"
}
stdout { codec => rubydebug }
}
并且我已经使用 Kibana 中的控制台将映射添加到 ElasticSearch
PUT postcodes
{
"settings": {
"number_of_shards": 1
},
"mappings": {
"feature": {
"_all": { "enabled": true },
"properties": {
"postcode": {"type": "text"},
"location": {"type": "geo_point"}
}
}
}
}
我使用
检查索引的映射GET postcodes/_mapping
{
"postcodes": {
"mappings": {
"feature": {
"_all": {
"enabled": true
},
"properties": {
"location": {
"type": "geo_point"
},
"postcode": {
"type": "text"
}
}
}
}
}
}
因此,在查看文档和发布的其他问题后,这一切似乎都是正确的。
然而当我运行
bin/logstash -f postcodes.conf
我得到一个错误:
[location] is defined as an object in mapping [logs] but this name is already used for a field in other types
我尝试了很多替代方法;
删除了索引并创建了 template.json 并更改了我的 conf 文件以具有额外的设置:
manage_template => true
template => "postcode_template.json"
template_name =>"open_names"
template_overwrite => true
这会得到同样的错误。
我已经设法通过不提供模板来加载数据,但是数据永远不会作为 geo_point 加载,因此您无法使用 Kibana Tile Map 来可视化数据
谁能解释为什么我会收到该错误以及我应该使用什么方法?
您的问题是您的 elasticsearch
输出中没有 document_type => feature
。否则,它将在 logs
类型上创建对象,这就是您遇到此冲突的原因。