Create data view APIedit

[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 data views.

Requestedit

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

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

Path parametersedit

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

Request bodyedit

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

Response codeedit

200
Indicates a successful call.

Examplesedit

Create a data view 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 data view 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 data view object:

{
    "index_pattern": {...}
}