Skip to content

Commit

Permalink
[DOCS] Add deprecated index pattern APIs (#124065)
Browse files Browse the repository at this point in the history
  • Loading branch information
lcawl authored Jan 31, 2022
1 parent b1a8543 commit ee08101
Show file tree
Hide file tree
Showing 15 changed files with 906 additions and 60 deletions.
44 changes: 44 additions & 0 deletions docs/api/index-patterns.asciidoc
Original file line number Diff line number Diff line change
@@ -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 changes: 105 additions & 0 deletions docs/api/index-patterns/create.asciidoc
Original file line number Diff line number Diff line change
@@ -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 changes: 57 additions & 0 deletions docs/api/index-patterns/default-get.asciidoc
Original file line number Diff line number Diff line change
@@ -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 changes: 86 additions & 0 deletions docs/api/index-patterns/default-set.asciidoc
Original file line number Diff line number Diff line change
@@ -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 changes: 43 additions & 0 deletions docs/api/index-patterns/delete.asciidoc
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit ee08101

Please sign in to comment.