mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
(cherry picked from commit ee081010d8
)
Co-authored-by: Lisa Cawley <lcawley@elastic.co>
This commit is contained in:
parent
57ca5e139a
commit
d511aeca95
15 changed files with 906 additions and 60 deletions
44
docs/api/index-patterns.asciidoc
Normal file
44
docs/api/index-patterns.asciidoc
Normal file
|
@ -0,0 +1,44 @@
|
|||
[[index-patterns-api]]
|
||||
== Index patterns APIs
|
||||
|
||||
deprecated::[8.0.0,Use <<data-views-api>> instead.]
|
||||
|
||||
experimental[] Manage {kib} index patterns.
|
||||
|
||||
WARNING: Do not write documents directly to the `.kibana` index. When you write directly
|
||||
to the `.kibana` index, the data becomes corrupted and permanently breaks future {kib} versions.
|
||||
|
||||
WARNING: Use the index patterns API for managing {kib} index patterns instead of lower-level <<saved-objects-api, saved objects API>>.
|
||||
|
||||
The following index patterns APIs are available:
|
||||
|
||||
* Index patterns
|
||||
** <<index-patterns-api-get, Get index pattern API>> to retrieve a single {kib} index pattern
|
||||
** <<index-patterns-api-create, Create index pattern API>> to create {kib} index pattern
|
||||
** <<index-patterns-api-update, Update index pattern API>> to partially updated {kib} index pattern
|
||||
** <<index-patterns-api-delete, Delete index pattern API>> to delete {kib} index pattern
|
||||
* Default index pattern
|
||||
** <<index-patterns-api-default-get, Get default index pattern API>> to retrieve a default index pattern
|
||||
** <<index-patterns-api-default-set, Set default index pattern API>> to set a default index pattern
|
||||
* Fields
|
||||
** <<index-patterns-fields-api-update, Update index pattern field>> to change field metadata, such as `count`, `customLabel` and `format`
|
||||
* Runtime fields
|
||||
** <<index-patterns-runtime-field-api-get, Get runtime field API>> to retrieve a runtime field
|
||||
** <<index-patterns-runtime-field-api-create, Create runtime field API>> to create a runtime field
|
||||
** <<index-patterns-runtime-field-api-upsert, Upsert runtime field API>> to create or update a runtime field
|
||||
** <<index-patterns-runtime-field-api-update, Update runtime field API>> to partially update an existing runtime field
|
||||
** <<index-patterns-runtime-field-api-delete, Delete runtime field API>> to delete a runtime field
|
||||
|
||||
include::index-patterns/get.asciidoc[]
|
||||
include::index-patterns/create.asciidoc[]
|
||||
include::index-patterns/update.asciidoc[]
|
||||
include::index-patterns/delete.asciidoc[]
|
||||
include::index-patterns/default-get.asciidoc[]
|
||||
include::index-patterns/default-set.asciidoc[]
|
||||
include::index-patterns/update-fields.asciidoc[]
|
||||
include::index-patterns/runtime-fields/get.asciidoc[]
|
||||
include::index-patterns/runtime-fields/create.asciidoc[]
|
||||
include::index-patterns/runtime-fields/upsert.asciidoc[]
|
||||
include::index-patterns/runtime-fields/update.asciidoc[]
|
||||
include::index-patterns/runtime-fields/delete.asciidoc[]
|
||||
|
105
docs/api/index-patterns/create.asciidoc
Normal file
105
docs/api/index-patterns/create.asciidoc
Normal file
|
@ -0,0 +1,105 @@
|
|||
[[index-patterns-api-create]]
|
||||
=== Create index pattern API
|
||||
++++
|
||||
<titleabbrev>Create index pattern</titleabbrev>
|
||||
++++
|
||||
|
||||
deprecated::[8.0.0,Use <<data-views-api-create>> instead.]
|
||||
|
||||
experimental[] Create {kib} index patterns.
|
||||
|
||||
[[index-patterns-api-create-request]]
|
||||
==== Request
|
||||
|
||||
`POST <kibana host>:<port>/api/index_patterns/index_pattern`
|
||||
|
||||
`POST <kibana host>:<port>/s/<space_id>/api/index_patterns/index_pattern`
|
||||
|
||||
[[index-patterns-api-create-path-params]]
|
||||
==== Path parameters
|
||||
|
||||
`space_id`::
|
||||
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.
|
||||
|
||||
[[index-patterns-api-create-body-params]]
|
||||
==== Request body
|
||||
|
||||
`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.
|
||||
|
||||
[[index-patterns-api-create-request-codes]]
|
||||
==== Response code
|
||||
|
||||
`200`::
|
||||
Indicates a successful call.
|
||||
|
||||
[[index-patterns-api-create-example]]
|
||||
==== Examples
|
||||
|
||||
Create an index pattern with a custom title:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
$ curl -X POST api/index_patterns/index_pattern
|
||||
{
|
||||
"index_pattern": {
|
||||
"title": "hello"
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
||||
|
||||
Customize the creation behavior:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
$ curl -X POST api/index_patterns/index_pattern
|
||||
{
|
||||
"override": false,
|
||||
"refresh_fields": true,
|
||||
"index_pattern": {
|
||||
"title": "hello"
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
||||
|
||||
At creation, all index pattern fields are optional:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
$ curl -X POST api/index_patterns/index_pattern
|
||||
{
|
||||
"index_pattern": {
|
||||
"id": "...",
|
||||
"version": "...",
|
||||
"title": "...",
|
||||
"type": "...",
|
||||
"timeFieldName": "...",
|
||||
"sourceFilters": [],
|
||||
"fields": {},
|
||||
"typeMeta": {},
|
||||
"fieldFormats": {},
|
||||
"fieldAttrs": {},
|
||||
"runtimeFieldMap": {}
|
||||
"allowNoIndex": "..."
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
||||
|
||||
|
||||
The API returns the index pattern object:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
{
|
||||
"index_pattern": {...}
|
||||
}
|
||||
--------------------------------------------------
|
||||
|
57
docs/api/index-patterns/default-get.asciidoc
Normal file
57
docs/api/index-patterns/default-get.asciidoc
Normal file
|
@ -0,0 +1,57 @@
|
|||
[[index-patterns-api-default-get]]
|
||||
=== Get default index pattern API
|
||||
++++
|
||||
<titleabbrev>Get default index pattern</titleabbrev>
|
||||
++++
|
||||
|
||||
deprecated::[8.0.0,Use <<data-views-api-default-get>> instead.]
|
||||
|
||||
experimental[] Retrieve a default index pattern ID. Kibana UI uses default index pattern unless user picks a different one.
|
||||
|
||||
[[index-patterns-api-default-get-request]]
|
||||
==== Request
|
||||
|
||||
`GET <kibana host>:<port>/api/index_patterns/default`
|
||||
|
||||
`GET <kibana host>:<port>/s/<space_id>/api/index_patterns/default`
|
||||
|
||||
[[index-patterns-api-default-get-params]]
|
||||
==== Path parameters
|
||||
|
||||
`space_id`::
|
||||
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.
|
||||
|
||||
[[index-patterns-api-default-get-codes]]
|
||||
==== Response code
|
||||
|
||||
`200`::
|
||||
Indicates a successful call.
|
||||
|
||||
[[index-patterns-api-default-get-example]]
|
||||
==== Example
|
||||
|
||||
Retrieve the default index pattern id:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
$ curl -X GET api/index_patterns/default
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
||||
|
||||
The API returns an ID of a default index pattern:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
{
|
||||
"index_pattern_id": "..."
|
||||
}
|
||||
--------------------------------------------------
|
||||
|
||||
In case there is no default index pattern, the API returns:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
{
|
||||
"index_pattern_id": null
|
||||
}
|
||||
--------------------------------------------------
|
86
docs/api/index-patterns/default-set.asciidoc
Normal file
86
docs/api/index-patterns/default-set.asciidoc
Normal file
|
@ -0,0 +1,86 @@
|
|||
[[index-patterns-api-default-set]]
|
||||
=== Set default index pattern API
|
||||
++++
|
||||
<titleabbrev>Set default index pattern</titleabbrev>
|
||||
++++
|
||||
|
||||
deprecated::[8.0.0,Use <<data-views-api-default-set>> instead.]
|
||||
|
||||
experimental[] Set a default index pattern ID. Kibana UI will use default index pattern unless user picks a different one.
|
||||
The API doesn't validate if given `index_pattern_id` is a valid id.
|
||||
|
||||
[[index-patterns-api-default-set-request]]
|
||||
==== Request
|
||||
|
||||
`POST <kibana host>:<port>/api/index_patterns/default`
|
||||
|
||||
`POST <kibana host>:<port>/s/<space_id>/api/index_patterns/default`
|
||||
|
||||
[[index-patterns-api-default-set-params]]
|
||||
==== Path parameters
|
||||
|
||||
`space_id`::
|
||||
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.
|
||||
|
||||
[[index-patterns-api-default-set-body]]
|
||||
==== Request body
|
||||
|
||||
`index_pattern_id`:: (Required, `string` or `null`) Sets a default index pattern id. Use `null` to unset a default index pattern.
|
||||
|
||||
`force`:: (Optional, boolean) Updates existing default index pattern id. The default is `false`.
|
||||
|
||||
|
||||
[[index-patterns-api-default-set-codes]]
|
||||
==== Response code
|
||||
|
||||
`200`::
|
||||
Indicates a successful call.
|
||||
|
||||
[[index-patterns-api-default-set-example]]
|
||||
==== Example
|
||||
|
||||
Set the default index pattern id if none is set:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
$ curl -X POST api/index_patterns/default
|
||||
{
|
||||
"index_pattern_id": "..."
|
||||
}
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
||||
|
||||
|
||||
Upsert the default index pattern:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
$ curl -X POST api/index_patterns/default
|
||||
{
|
||||
"index_pattern_id": "...",
|
||||
"force": true
|
||||
}
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
||||
|
||||
Unset the default index pattern:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
$ curl -X POST api/index_patterns/default
|
||||
{
|
||||
"index_pattern_id": null,
|
||||
"force": true
|
||||
}
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
||||
|
||||
The API returns:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
{
|
||||
"acknowledged": true
|
||||
}
|
||||
--------------------------------------------------
|
||||
|
43
docs/api/index-patterns/delete.asciidoc
Normal file
43
docs/api/index-patterns/delete.asciidoc
Normal file
|
@ -0,0 +1,43 @@
|
|||
[[index-patterns-api-delete]]
|
||||
=== Delete index pattern API
|
||||
++++
|
||||
<titleabbrev>Delete index pattern</titleabbrev>
|
||||
++++
|
||||
|
||||
deprecated::[8.0.0,Use <<data-views-api-delete>> instead.]
|
||||
|
||||
experimental[] Delete {kib} index patterns.
|
||||
|
||||
WARNING: Once you delete an index pattern, _it cannot be recovered_.
|
||||
|
||||
[[index-patterns-api-delete-request]]
|
||||
==== Request
|
||||
|
||||
`DELETE <kibana host>:<port>/api/index_patterns/index_pattern/<id>`
|
||||
|
||||
`DELETE <kibana host>:<port>/s/<space_id>/api/index_patterns/index_pattern/<id>`
|
||||
|
||||
[[index-patterns-api-delete-path-params]]
|
||||
==== Path parameters
|
||||
|
||||
`space_id`::
|
||||
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.
|
||||
|
||||
`id`::
|
||||
(Required, string) The ID of the index pattern you want to delete.
|
||||
|
||||
[[index-patterns-api-delete-response-codes]]
|
||||
==== Response code
|
||||
|
||||
`200`::
|
||||
Indicates that index pattern is deleted. Returns an empty response body.
|
||||
|
||||
==== Example
|
||||
|
||||
Delete an index pattern object with the `my-pattern` ID:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
$ curl -X DELETE api/index_patterns/index_pattern/my-pattern
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
67
docs/api/index-patterns/get.asciidoc
Normal file
67
docs/api/index-patterns/get.asciidoc
Normal file
|
@ -0,0 +1,67 @@
|
|||
[[index-patterns-api-get]]
|
||||
=== Get index pattern API
|
||||
++++
|
||||
<titleabbrev>Get index pattern</titleabbrev>
|
||||
++++
|
||||
|
||||
deprecated::[8.0.0,Use <<data-views-api-get>> instead.]
|
||||
|
||||
experimental[] Retrieve a single {kib} index pattern by ID.
|
||||
|
||||
[[index-patterns-api-get-request]]
|
||||
==== Request
|
||||
|
||||
`GET <kibana host>:<port>/api/index_patterns/index_pattern/<id>`
|
||||
|
||||
`GET <kibana host>:<port>/s/<space_id>/api/index_patterns/index_pattern/<id>`
|
||||
|
||||
[[index-patterns-api-get-params]]
|
||||
==== Path parameters
|
||||
|
||||
`space_id`::
|
||||
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.
|
||||
|
||||
`id`::
|
||||
(Required, string) The ID of the index pattern you want to retrieve.
|
||||
|
||||
[[index-patterns-api-get-codes]]
|
||||
==== Response code
|
||||
|
||||
`200`::
|
||||
Indicates a successful call.
|
||||
|
||||
`404`::
|
||||
The specified index pattern and ID doesn't exist.
|
||||
|
||||
[[index-patterns-api-get-example]]
|
||||
==== Example
|
||||
|
||||
Retrieve the index pattern object with the `my-pattern` ID:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
$ curl -X GET api/index_patterns/index_pattern/my-pattern
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
||||
|
||||
The API returns an index pattern object:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
{
|
||||
"index_pattern": {
|
||||
"id": "my-pattern",
|
||||
"version": "...",
|
||||
"title": "...",
|
||||
"type": "...",
|
||||
"timeFieldName": "...",
|
||||
"sourceFilters": [],
|
||||
"fields": {},
|
||||
"typeMeta": {},
|
||||
"fieldFormats": {},
|
||||
"fieldAttrs": {},
|
||||
"runtimeFieldMap" {},
|
||||
"allowNoIndex: "..."
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
63
docs/api/index-patterns/runtime-fields/create.asciidoc
Normal file
63
docs/api/index-patterns/runtime-fields/create.asciidoc
Normal file
|
@ -0,0 +1,63 @@
|
|||
[[index-patterns-runtime-field-api-create]]
|
||||
=== Create runtime field API
|
||||
++++
|
||||
<titleabbrev>Create runtime field</titleabbrev>
|
||||
++++
|
||||
|
||||
deprecated::[8.0.0,Use <<data-views-runtime-field-api-create>> instead.]
|
||||
|
||||
experimental[] Create a runtime field
|
||||
|
||||
[[index-patterns-runtime-field-create-request]]
|
||||
==== Request
|
||||
|
||||
`POST <kibana host>:<port>/api/index_patterns/index_pattern/<index_pattern_id>/runtime_field`
|
||||
|
||||
`POST <kibana host>:<port>/s/<space_id>/api/index_patterns/index_pattern/<index_pattern_id>/runtime_field`
|
||||
|
||||
[[index-patterns-runtime-field-create-params]]
|
||||
==== Path parameters
|
||||
|
||||
`space_id`::
|
||||
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.
|
||||
|
||||
`index_pattern_id`::
|
||||
(Required, string) The ID of the index pattern.
|
||||
|
||||
[[index-patterns-runtime-field-create-body]]
|
||||
==== Request body
|
||||
|
||||
`name`:: (Required, string) The name for a runtime field.
|
||||
|
||||
`runtimeField`:: (Required, object) The runtime field definition object.
|
||||
|
||||
|
||||
[[index-patterns-runtime-field-create-example]]
|
||||
==== Examples
|
||||
|
||||
Create a runtime field on an index pattern:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
$ curl -X POST api/index_patterns/index_pattern/<index_pattern_id>/runtime_field
|
||||
{
|
||||
"name": "runtimeFoo",
|
||||
"runtimeField": {
|
||||
"type": "long",
|
||||
"script": {
|
||||
"source": "emit(doc["foo"].value)"
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
||||
|
||||
The API returns created runtime field object and update index pattern object:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
{
|
||||
"index_pattern": {...},
|
||||
"field": {...}
|
||||
}
|
||||
--------------------------------------------------
|
39
docs/api/index-patterns/runtime-fields/delete.asciidoc
Normal file
39
docs/api/index-patterns/runtime-fields/delete.asciidoc
Normal file
|
@ -0,0 +1,39 @@
|
|||
[[index-patterns-runtime-field-api-delete]]
|
||||
=== Delete runtime field API
|
||||
++++
|
||||
<titleabbrev>Delete runtime field</titleabbrev>
|
||||
++++
|
||||
|
||||
deprecated::[8.0.0,Use <<data-views-runtime-field-api-delete>> instead.]
|
||||
|
||||
experimental[] Delete a runtime field from an index pattern.
|
||||
|
||||
[[index-patterns-runtime-field-api-delete-request]]
|
||||
==== Request
|
||||
|
||||
`DELETE <kibana host>:<port>/api/index_patterns/index_pattern/<index_pattern_id>/runtime_field/<name>`
|
||||
|
||||
`DELETE <kibana host>:<port>/s/<space_id>/api/index_patterns/index_pattern/<index_pattern_id>/runtime_field/<name>`
|
||||
|
||||
[[index-patterns-runtime-field-api-delete-path-params]]
|
||||
==== Path parameters
|
||||
|
||||
`space_id`::
|
||||
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.
|
||||
|
||||
`index_pattern_id`::
|
||||
(Required, string) The ID of the index pattern your want to delete a runtime field from.
|
||||
|
||||
`name`::
|
||||
(Required, string) The name of the runtime field you want to delete.
|
||||
|
||||
|
||||
==== Example
|
||||
|
||||
Delete a runtime field from an index pattern:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
$ curl -X DELETE api/index_patterns/index_pattern/<my-pattern>/runtime_field/<runtime-field-name>
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
54
docs/api/index-patterns/runtime-fields/get.asciidoc
Normal file
54
docs/api/index-patterns/runtime-fields/get.asciidoc
Normal file
|
@ -0,0 +1,54 @@
|
|||
[[index-patterns-runtime-field-api-get]]
|
||||
=== Get runtime field API
|
||||
++++
|
||||
<titleabbrev>Get runtime field</titleabbrev>
|
||||
++++
|
||||
|
||||
deprecated::[8.0.0,Use <<data-views-runtime-field-api-get>> instead.]
|
||||
|
||||
experimental[] Get a runtime field
|
||||
|
||||
[[index-patterns-runtime-field-get-request]]
|
||||
==== Request
|
||||
|
||||
`GET <kibana host>:<port>/api/index_patterns/index_pattern/<index_pattern_id>/runtime_field/<name>`
|
||||
|
||||
`GET <kibana host>:<port>/s/<space_id>/api/index_patterns/index_pattern/<index_pattern_id>/runtime_field/<name>`
|
||||
|
||||
[[index-patterns-runtime-field-get-params]]
|
||||
==== Path parameters
|
||||
|
||||
`space_id`::
|
||||
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.
|
||||
|
||||
`index_pattern_id`::
|
||||
(Required, string) The ID of the index pattern.
|
||||
|
||||
`name`::
|
||||
(Required, string) The name of the runtime field you want to retrieve.
|
||||
|
||||
|
||||
[[index-patterns-runtime-field-get-example]]
|
||||
==== Example
|
||||
|
||||
Retrieve a runtime field named `foo` of index pattern with the `my-pattern` ID:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
$ curl -X GET api/index_patterns/index_pattern/my-pattern/runtime_field/foo
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
||||
|
||||
The API returns a runtime `field` object, and a `runtimeField` definition object:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
{
|
||||
"field": {
|
||||
...
|
||||
},
|
||||
"runtimeField": {
|
||||
...
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
68
docs/api/index-patterns/runtime-fields/update.asciidoc
Normal file
68
docs/api/index-patterns/runtime-fields/update.asciidoc
Normal file
|
@ -0,0 +1,68 @@
|
|||
[[index-patterns-runtime-field-api-update]]
|
||||
=== Update runtime field API
|
||||
++++
|
||||
<titleabbrev>Update runtime field</titleabbrev>
|
||||
++++
|
||||
|
||||
deprecated::[8.0.0,Use <<data-views-runtime-field-api-update>> instead.]
|
||||
|
||||
experimental[] Update an existing runtime field
|
||||
|
||||
[[index-patterns-runtime-field-update-request]]
|
||||
==== Request
|
||||
|
||||
`POST <kibana host>:<port>/api/index_patterns/index_pattern/<index_pattern_id>/runtime_field/<name>`
|
||||
|
||||
`POST <kibana host>:<port>/s/<space_id>/api/index_patterns/index_pattern/<index_pattern_id>/runtime_field/<name>`
|
||||
|
||||
[[index-patterns-runtime-field-update-params]]
|
||||
==== Path parameters
|
||||
|
||||
`space_id`::
|
||||
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.
|
||||
|
||||
`index_pattern_id`::
|
||||
(Required, string) The ID of the index pattern.
|
||||
|
||||
`name`::
|
||||
(Required, string) The name of the runtime field you want to update.
|
||||
|
||||
[[index-patterns-runtime-field-update-body]]
|
||||
==== Request body
|
||||
|
||||
`runtimeField`:: (Required, object) The runtime field definition object.
|
||||
|
||||
You can update following fields:
|
||||
|
||||
* `type`
|
||||
* `script`
|
||||
|
||||
|
||||
|
||||
[[index-patterns-runtime-field-update-example]]
|
||||
==== Examples
|
||||
|
||||
Update an existing runtime field on an index pattern:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
$ curl -X POST api/index_patterns/index_pattern/<index_pattern_id>/runtime_field/<runtime_field_name>
|
||||
{
|
||||
"runtimeField": {
|
||||
"script": {
|
||||
"source": "emit(doc["bar"].value)"
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
||||
|
||||
The API returns updated runtime field object and updated index pattern object:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
{
|
||||
"index_pattern": {...},
|
||||
"field": {...}
|
||||
}
|
||||
--------------------------------------------------
|
63
docs/api/index-patterns/runtime-fields/upsert.asciidoc
Normal file
63
docs/api/index-patterns/runtime-fields/upsert.asciidoc
Normal file
|
@ -0,0 +1,63 @@
|
|||
[[index-patterns-runtime-field-api-upsert]]
|
||||
=== Upsert runtime field API
|
||||
++++
|
||||
<titleabbrev>Upsert runtime field</titleabbrev>
|
||||
++++
|
||||
|
||||
deprecated::[8.0.0,Use <<data-views-runtime-field-api-upsert>> instead.]
|
||||
|
||||
experimental[] Create or update an existing runtime field
|
||||
|
||||
[[index-patterns-runtime-field-upsert-request]]
|
||||
==== Request
|
||||
|
||||
`PUT <kibana host>:<port>/api/index_patterns/index_pattern/<index_pattern_id>/runtime_field`
|
||||
|
||||
`PUT <kibana host>:<port>/s/<space_id>/api/index_patterns/index_pattern/<index_pattern_id>/runtime_field`
|
||||
|
||||
[[index-patterns-runtime-field-upsert-params]]
|
||||
==== Path parameters
|
||||
|
||||
`space_id`::
|
||||
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.
|
||||
|
||||
`index_pattern_id`::
|
||||
(Required, string) The ID of the index pattern.
|
||||
|
||||
[[index-patterns-runtime-field-upsert-body]]
|
||||
==== Request body
|
||||
|
||||
`name`:: (Required, string) The name for a new runtime field or a name of an existing runtime field.
|
||||
|
||||
`runtimeField`:: (Required, object) The runtime field definition object.
|
||||
|
||||
|
||||
[[index-patterns-runtime-field-upsert-example]]
|
||||
==== Examples
|
||||
|
||||
Create or update an existing runtime field on an index pattern:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
$ curl -X PUT api/index_patterns/index_pattern/<index_pattern_id>/runtime_field
|
||||
{
|
||||
"name": "runtimeFoo",
|
||||
"runtimeField": {
|
||||
"type": "long",
|
||||
"script": {
|
||||
"source": "emit(doc["foo"].value)"
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
||||
|
||||
The API returns created or updated runtime field object and updated index pattern object:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
{
|
||||
"index_pattern": {...},
|
||||
"field": {...}
|
||||
}
|
||||
--------------------------------------------------
|
102
docs/api/index-patterns/update-fields.asciidoc
Normal file
102
docs/api/index-patterns/update-fields.asciidoc
Normal file
|
@ -0,0 +1,102 @@
|
|||
[[index-patterns-fields-api-update]]
|
||||
=== Update index pattern fields API
|
||||
++++
|
||||
<titleabbrev>Update index pattern fields metadata</titleabbrev>
|
||||
++++
|
||||
|
||||
deprecated::[8.0.0,Use <<data-views-fields-api-update>> instead.]
|
||||
|
||||
experimental[] Update fields presentation metadata, such as `count`,
|
||||
`customLabel`, and `format`. You can update multiple fields in one request. Updates
|
||||
are merged with persisted metadata. To remove existing metadata, specify `null` as the value.
|
||||
|
||||
[[index-patterns-fields-api-update-request]]
|
||||
==== Request
|
||||
|
||||
`POST <kibana host>:<port>/api/index_patterns/index_pattern/<id>/fields`
|
||||
|
||||
`POST <kibana host>:<port>/s/<space_id>/api/index_patterns/index_pattern/<id>/fields`
|
||||
|
||||
[[index-patterns-fields-api-update-path-params]]
|
||||
==== Path parameters
|
||||
|
||||
`space_id`::
|
||||
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.
|
||||
|
||||
`id`::
|
||||
(Required, string) The ID of the index pattern fields you want to update.
|
||||
|
||||
[[index-patterns-fields-api-update-request-body]]
|
||||
==== Request body
|
||||
|
||||
`fields`::
|
||||
(Required, object) the field object
|
||||
|
||||
|
||||
[[index-patterns-fields-api-update-errors-codes]]
|
||||
==== Response code
|
||||
|
||||
`200`::
|
||||
Indicates a successful call.
|
||||
|
||||
[[index-patterns-fields-api-update-example]]
|
||||
==== Examples
|
||||
|
||||
Set popularity `count` for field `foo`:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
$ curl -X POST api/saved_objects/index-pattern/my-pattern/fields
|
||||
{
|
||||
"fields": {
|
||||
"foo": {
|
||||
"count": 123
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
||||
|
||||
Update multiple metadata fields in one request:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
$ curl -X POST api/saved_objects/index-pattern/my-pattern/fields
|
||||
{
|
||||
"fields": {
|
||||
"foo": {
|
||||
"count": 123,
|
||||
"customLabel": "Foo"
|
||||
},
|
||||
"bar": {
|
||||
"customLabel": "Bar"
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
||||
|
||||
Use `null` value to delete metadata:
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
$ curl -X POST api/saved_objects/index-pattern/my-pattern/fields
|
||||
{
|
||||
"fields": {
|
||||
"foo": {
|
||||
"customLabel": null
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
||||
|
||||
|
||||
The endpoint returns the updated index pattern object:
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
{
|
||||
"index_pattern": {
|
||||
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
114
docs/api/index-patterns/update.asciidoc
Normal file
114
docs/api/index-patterns/update.asciidoc
Normal file
|
@ -0,0 +1,114 @@
|
|||
[[index-patterns-api-update]]
|
||||
=== Update index pattern API
|
||||
++++
|
||||
<titleabbrev>Update index pattern</titleabbrev>
|
||||
++++
|
||||
|
||||
deprecated::[8.0.0,Use <<data-views-api-update>> instead.]
|
||||
|
||||
experimental[] Update part of an index pattern. Only the specified fields are updated in the
|
||||
index pattern. Unspecified fields stay as they are persisted.
|
||||
|
||||
[[index-patterns-api-update-request]]
|
||||
==== Request
|
||||
|
||||
`POST <kibana host>:<port>/api/index_patterns/index_pattern/<id>`
|
||||
|
||||
`POST <kibana host>:<port>/s/<space_id>/api/index_patterns/index_pattern/<id>`
|
||||
|
||||
[[index-patterns-api-update-path-params]]
|
||||
==== Path parameters
|
||||
|
||||
`space_id`::
|
||||
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.
|
||||
|
||||
`id`::
|
||||
(Required, string) The ID of the index pattern you want to update.
|
||||
|
||||
[[index-patterns-api-update-request-body]]
|
||||
==== Request body
|
||||
|
||||
`refresh_fields`:: (Optional, boolean) Reloads the index pattern fields after
|
||||
the index pattern is updated. The default is `false`.
|
||||
|
||||
`index_pattern`::
|
||||
(Required, object) The index patterns fields you want to update.
|
||||
+
|
||||
|
||||
You can partially update the following fields:
|
||||
|
||||
* `title`
|
||||
* `timeFieldName`
|
||||
* `fields`
|
||||
* `sourceFilters`
|
||||
* `fieldFormatMap`
|
||||
* `type`
|
||||
* `typeMeta`
|
||||
|
||||
[[index-patterns-api-update-errors-codes]]
|
||||
==== Response code
|
||||
|
||||
`200`::
|
||||
Indicates a successful call.
|
||||
|
||||
[[index-patterns-api-update-example]]
|
||||
==== Examples
|
||||
|
||||
Update a title of the `<my-pattern>` index pattern:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
$ curl -X POST api/saved_objects/index-pattern/my-pattern
|
||||
{
|
||||
"index_pattern": {
|
||||
"title": "some-other-pattern-*"
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
||||
|
||||
Customize the update behavior:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
$ curl -X POST api/saved_objects/index-pattern/my-pattern
|
||||
{
|
||||
"refresh_fields": true,
|
||||
"index_pattern": {
|
||||
"fields": {}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
||||
|
||||
|
||||
All update fields are optional, but you can specify the following fields:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
$ curl -X POST api/saved_objects/index-pattern/my-pattern
|
||||
{
|
||||
"index_pattern": {
|
||||
"title": "...",
|
||||
"timeFieldName": "...",
|
||||
"sourceFilters": [],
|
||||
"fieldFormats": {},
|
||||
"type": "...",
|
||||
"typeMeta": {},
|
||||
"fields": {},
|
||||
"runtimeFieldMap": {}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
||||
|
||||
The API returns the updated index pattern object:
|
||||
|
||||
[source,sh]
|
||||
--------------------------------------------------
|
||||
{
|
||||
"index_pattern": {
|
||||
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
|
@ -381,66 +381,6 @@ This content has moved. Refer to <<data-views>>.
|
|||
|
||||
This content has moved. Refer to <<managing-data-views>>.
|
||||
|
||||
[role="exclude",id="index-patterns-api"]
|
||||
== Index patterns has been renamed to data views.
|
||||
|
||||
This content has moved. Refer to <<data-views-api>>.
|
||||
|
||||
[role="exclude",id="index-patterns-api-create"]
|
||||
== Index patterns has been renamed to data views.
|
||||
|
||||
This content has moved. Refer to <<data-views-api-create>>.
|
||||
|
||||
[role="exclude",id="index-patterns-api-default-get"]
|
||||
== Index patterns has been renamed to data views.
|
||||
|
||||
This content has moved. Refer to <<data-views-api-default-get>>.
|
||||
|
||||
[role="exclude",id="index-patterns-api-default-set"]
|
||||
== Index patterns has been renamed to data views.
|
||||
|
||||
This content has moved. Refer to <<data-views-api-default-set>>.
|
||||
|
||||
[role="exclude",id="index-patterns-api-delete"]
|
||||
== Index patterns has been renamed to data views.
|
||||
|
||||
This content has moved. Refer to <<data-views-api-delete>>.
|
||||
|
||||
[role="exclude",id="index-patterns-api-get"]
|
||||
== Index patterns has been renamed to data views.
|
||||
|
||||
This content has moved. Refer to <<data-views-api-get>>.
|
||||
|
||||
[role="exclude",id="index-patterns-runtime-field-api-create"]
|
||||
== Index patterns has been renamed to data views.
|
||||
|
||||
This content has moved. Refer to <<data-views-runtime-field-api-create>>.
|
||||
|
||||
[role="exclude",id="index-patterns-runtime-field-api-delete"]
|
||||
== Index patterns has been renamed to data views.
|
||||
|
||||
This content has moved. Refer to <<data-views-runtime-field-api-delete>>.
|
||||
|
||||
[role="exclude",id="index-patterns-runtime-field-api-get"]
|
||||
== Index patterns has been renamed to data views.
|
||||
|
||||
This content has moved. Refer to <<data-views-runtime-field-api-get>>.
|
||||
|
||||
[role="exclude",id="index-patterns-runtime-field-api-update"]
|
||||
== Index patterns has been renamed to data views.
|
||||
|
||||
This content has moved. Refer to <<data-views-runtime-field-api-update>>.
|
||||
|
||||
[role="exclude",id="index-patterns-runtime-field-api-upsert"]
|
||||
== Index patterns has been renamed to data views.
|
||||
|
||||
This content has moved. Refer to <<data-views-runtime-field-api-upsert>>.
|
||||
|
||||
[role="exclude",id="index-patterns-api-update"]
|
||||
== Index patterns has been renamed to data views.
|
||||
|
||||
This content has moved. Refer to <<data-views-api-update>>.
|
||||
|
||||
[role="exclude",id="xpack-kibana-role-management"]
|
||||
== Kibana role management.
|
||||
|
||||
|
|
|
@ -92,6 +92,7 @@ include::{kib-repo-dir}/api/role-management.asciidoc[]
|
|||
include::{kib-repo-dir}/api/session-management.asciidoc[]
|
||||
include::{kib-repo-dir}/api/saved-objects.asciidoc[]
|
||||
include::{kib-repo-dir}/api/data-views.asciidoc[]
|
||||
include::{kib-repo-dir}/api/index-patterns.asciidoc[]
|
||||
include::{kib-repo-dir}/api/alerting.asciidoc[]
|
||||
include::{kib-repo-dir}/api/actions-and-connectors.asciidoc[]
|
||||
include::{kib-repo-dir}/api/dashboard-api.asciidoc[]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue