Create data view API

edit

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

Request

edit

POST <kibana host>:<port>/api/data_views/data_view

POST <kibana host>:<port>/s/<space_id>/api/data_views/data_view

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 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.
data_view
(Required, object) The data view object. All fields are optional.

Response code

edit
200
Indicates a successful call.

Examples

edit

Create a data view with a custom title:

$ curl -X POST api/data_views/data_view
{
  "data_view": {
     "title": "hello"
  }
}

Customize the creation behavior:

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

At creation, all data view fields are optional:

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

The API returns the data view object:

{
    "data_view": {...}
}