Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 591
Julen Cestero Avatar asked Nov 21 '17 10:11

Julen Cestero


People also ask

Can you create an index in Kibana?

Create an index patterneditOpen the main menu, then click to Stack Management > Index Patterns. Click Create index pattern. Start typing in the Index pattern field, and Kibana looks for the names of indices, data streams, and aliases that match your input.

How do I change the index pattern in Kibana?

Go to Settings -> Objects -> Visualizations and you can edit the definition manually. Amazing Alain . You got expertise to be proud of. For Kibana Version: 6.4.


1 Answers

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"
  }
}'
like image 119
Sanoussy Diallo Avatar answered Sep 28 '22 17:09

Sanoussy Diallo