一尘不染

使用Kibana 6.0或7+(v7.0.1)从控制台创建索引模式

elasticsearch

我最近将我的ElasticStack实例从5.5升级到了6.0,看来该版本的一些重大更改已损害了我的产品线。我有一个脚本,该脚本根据ElasticSearch中的索引为某些类似索引的组自动创建索引模式。问题在于,随着6.0版本的新映射更改,我无法从控制台添加任何新的索引模式。这是我在5.5中使用并正常工作的请求:

curl -XPOST "http://localhost:9200/.kibana/index-pattern" -H 'Content-  Type: application/json' -d'
{
  "title" : "index_name",
  "timeFieldName" : "execution_time"
}'

这是我现在在6.0中从ElasticSearch获得的响应:

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "Rejecting mapping update to [.kibana] as the final mapping would have more than 1 type: [index-pattern, doc]"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "Rejecting mapping update to [.kibana] as the final mapping would have more than 1 type: [index-pattern, doc]"
  },
  "status": 400
}

如何从控制台添加索引模式,以避免出现这种多重映射问题?


阅读 578

收藏
2020-06-22

共1个答案

一尘不染

URL已在6.0.0版本中更改,这是新的URL:

http:// localhost:9200 / .kibana / doc / doc:index-pattern:my-index-pattern-name

此CURL应该适合您:

curl -XPOST "http://localhost:9200/.kibana/doc/index-pattern:my-index-pattern-name" -H 'Content-Type: application/json' -d'
{
  "type" : "index-pattern",
  "index-pattern" : {
    "title": "my-index-pattern-name*",
    "timeFieldName": "execution_time"
  }
}'
2020-06-22