illegal_argument_exception 在创建弹性搜索映射时
illegal_argument_exception while creating elasticsearch mapping
我正在尝试将日志从 logstash 流式传输到 elasticsearch (5.5.0)。我正在使用 filebeat 将日志发送到 logstash。
我还没有定义任何索引;它是在第一次推送数据时自动定义的(比如 "test1")。
现在,我想创建另一个索引 ("test2"),以便我可以管理字段数据类型。为此,我得到了 test1 的映射。更新了索引名称。并使用此数据 PUT 调用 test2。但是,它失败了,结果如下:
`ubuntu@elasticsearch:~$ curl -XPUT 'localhost:9200/test2?pretty' -H 'Content-Type: application/json' -d'@/tmp/mappings_test.json'
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "unknown setting [index.test2.mappings.log.properties.@timestamp.type] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
}
],
"type" : "illegal_argument_exception",
"reason" : "unknown setting [index.test2.mappings.log.properties.@timestamp.type] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
},
"status" : 400
}
`
以下是我正在使用的 json 的摘录。
`
{
"test2" : {
"mappings" : {
"log" : {
"properties" : {
"@timestamp" : {
"type" : "date"
},
"@version" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"accept_date" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
....
`
我只修改了索引名称。其余内容同test1索引映射
任何有关如何通过更新类型来创建这个新索引的帮助,我们将不胜感激?
您需要删除第二行的 test2
并且只有 mappings
:
PUT test2
{
"mappings" : { <---- this needs to be at the top level
"log" : {
"properties" : {
"@timestamp" : {
"type" : "date"
},
"@version" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"accept_date" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
....
我正在尝试将日志从 logstash 流式传输到 elasticsearch (5.5.0)。我正在使用 filebeat 将日志发送到 logstash。
我还没有定义任何索引;它是在第一次推送数据时自动定义的(比如 "test1")。
现在,我想创建另一个索引 ("test2"),以便我可以管理字段数据类型。为此,我得到了 test1 的映射。更新了索引名称。并使用此数据 PUT 调用 test2。但是,它失败了,结果如下:
`ubuntu@elasticsearch:~$ curl -XPUT 'localhost:9200/test2?pretty' -H 'Content-Type: application/json' -d'@/tmp/mappings_test.json'
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "unknown setting [index.test2.mappings.log.properties.@timestamp.type] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
}
],
"type" : "illegal_argument_exception",
"reason" : "unknown setting [index.test2.mappings.log.properties.@timestamp.type] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
},
"status" : 400
}
`
以下是我正在使用的 json 的摘录。 `
{
"test2" : {
"mappings" : {
"log" : {
"properties" : {
"@timestamp" : {
"type" : "date"
},
"@version" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"accept_date" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
....
`
我只修改了索引名称。其余内容同test1索引映射
任何有关如何通过更新类型来创建这个新索引的帮助,我们将不胜感激?
您需要删除第二行的 test2
并且只有 mappings
:
PUT test2
{
"mappings" : { <---- this needs to be at the top level
"log" : {
"properties" : {
"@timestamp" : {
"type" : "date"
},
"@version" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"accept_date" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
....