IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Create data view API
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
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
editPOST <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_idis 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. -
index_pattern - (Required, object) The data view object. All fields are optional.
Response code
edit-
200 - Indicates a successful call.
Examples
editCreate 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": {...}
}