Error Provisioning Index Pattern

Hi,
I'm trying to create an index pattern from the following json file:

{
  "index_pattern": {
    "id": "<pattern_id>"
    "version": "0.1"
    "title": "test-*",
    "timeFieldName": "@timestamp",
    "fieldFormats": {},
    "fieldAttrs": {},
    "allowNoIndex": true
  }
}

However, when I apply this file I get the following error:

{"statusCode":400,"error":"Bad Request","message":"[request body.index_pattern.title]: expected value of type [string] but got [undefined]"}

What am I doing wrong here? Kibana version is 7.11.2.

Thx
D

Your json looks malformed as it's missing a few commas -- is that just from you copying the json over here? If not, I'd start by fixing that.

Ah, my bad. I should have noticed that! Thanks anyway :slight_smile:

1 Like

I spoke too soon it seems. Adding commas to the end of the json didn't fix the issue.

If I take an example from the documentation page for index pattern provisioning:

{
  "override": false,
  "refresh_fields": true,
  "index_pattern": {
     "title": "hello"
  }
}

I still get the same error:

{"statusCode":400,"error":"Bad Request","message":"[request body.index_pattern.title]: expected value of type [string] but got [undefined]"}

Hm, I just tested this on a 7.11.2 deployment and I can't reproduce it. What does your request look like?

Here's the curl I am using:

curl -v -X POST "https://my-kibana:9243/api/index_patterns/index_pattern" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -H '<AUTH HEADER OR COOKIE>' -d'
{
  "override": false,
  "refresh_fields": true,
  "index_pattern": {
     "title": "hello"
  }
}
'

And I get a 200 back.

My request looks like this:

curl -s -k -H "kbn-xsrf: true" -XPOST http://localhost:5601/api/index_patterns/index_pattern --data @test.json

And you are certain the json is not malformed? Does it work if you include the data inline (as in my example above)?

You might also try sending a Content-Type: application/json header.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.