Search code examples
elasticsearchlucenerequestkibana

Create index-patterns from console with Kibana 6.0 or 7+ (v7.0.1)


I recently upgraded my ElasticStack instance from 5.5 to 6.0, and it seems that some of the breaking changes of this version have harmed my pipeline. I had a script that, depending on the indices inside ElasticSearch, created index-patterns automatically for some groups of similar indices. The problem is that with the new mapping changes of the 6.0 version, I cannot add any new index-pattern from the console. This was the request I used and worked fine in 5.5:

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

This is the response I get now, in 6.0, from 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
}

How could I add index-patterns from the console avoiding this multiple mapping issue?


Solution

  • The URL has been changed in version 6.0.0, here is the new URL:

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

    This CURL should work for you:

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