Create index pattern API

edit

Deprecated in 8.0.0.

Use Create data view instead.

[preview] This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Create Kibana index patterns.

Request

edit

POST <kibana host>:<port>/api/index_patterns/index_pattern

POST <kibana host>:<port>/s/<space_id>/api/index_patterns/index_pattern

Path parameters

edit
space_id
(Optional, string) An identifier for the space. If space_id is not provided in the URL, the default space is used.

Request body

edit
override
(Optional, boolean) Overrides an existing index pattern if an index pattern with the provided title already exists. The default is false.
refresh_fields
(Optional, boolean) Reloads index pattern fields after the index pattern is stored. The default is false.
index_pattern
(Required, object) The index pattern object. All fields are optional.

Response code

edit
200
Indicates a successful call.

Examples

edit

Create an index pattern with a custom title:

$ curl -X POST api/index_patterns/index_pattern
{
  "index_pattern": {
     "title": "hello"
  }
}

Customize the creation behavior:

$ curl -X POST api/index_patterns/index_pattern
{
  "override": false,
  "refresh_fields": true,
  "index_pattern": {
     "title": "hello"
  }
}

At creation, all index pattern fields are optional:

$ curl -X POST api/index_patterns/index_pattern
{
  "index_pattern": {
      "id": "...",
      "version": "...",
      "title": "...",
      "type": "...",
      "timeFieldName": "...",
      "sourceFilters": [],
      "fields": {},
      "typeMeta": {},
      "fieldFormats": {},
      "fieldAttrs": {},
      "runtimeFieldMap": {}
      "allowNoIndex": "..."
    }
}

The API returns the index pattern object:

{
    "index_pattern": {...}
}