Skip to content

Commit

Permalink
[data views] data view api docs - index patterns => data views (elast…
Browse files Browse the repository at this point in the history
…ic#119415)

* initial pass at changing urls and anchors

* update api.asciidoc

* upate a few more anchor tags

* upate a few more anchor tags

* update data view api docs

* Update delete.asciidoc

* Update default-get.asciidoc

* add redirects

* fix redirects

* remove duplicate redirect

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
mattkime and kibanamachine committed Dec 1, 2021
1 parent 233643e commit eb4fb72
Show file tree
Hide file tree
Showing 20 changed files with 234 additions and 174 deletions.
2 changes: 1 addition & 1 deletion dev_docs/key_concepts/building_blocks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Check out <DocLink id="kibDevDocsKPTTutorial" text="the KibanaPageTemplate tutor

### Index Patterns

<DocLink id="kibDataPlugin" section="index-patterns-api" text="Index Patterns" /> are a high-level, space-aware
<DocLink id="kibDataPlugin" section="data-views-api" text="Index Patterns" /> are a high-level, space-aware
abstraction layer that sits above Data Streams and Elasticsearch indices. Index Patterns provide users
the ability to define and customize the data they wish to search and filter on, on a per-space basis.
For example, users can specify a set of indices, and they can customize the field list with runtime fields,
Expand Down
2 changes: 1 addition & 1 deletion dev_docs/tutorials/data_views.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ await data.indexPatterns.delete(dataViewId);

### Data view HTTP API

Rest-like HTTP CRUD+ API - [docs](https://www.elastic.co/guide/en/kibana/master/index-patterns-api.html)
Rest-like HTTP CRUD+ API - [docs](https://www.elastic.co/guide/en/kibana/master/data-views-api.html)
2 changes: 1 addition & 1 deletion docs/api/dashboard-api.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
deprecated::[7.15.0,Both of these APIs have been deprecated in favor of <<saved-objects-api-import>> and <<saved-objects-api-export>>.]

Import and export dashboards with the corresponding saved objects, such as visualizations, saved
searches, and index patterns.
searches, and data views.

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.
Expand Down
42 changes: 42 additions & 0 deletions docs/api/data-views.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[[data-views-api]]
== Data views API

experimental[] Manage data views, formerly known as {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 data views APIs for managing data views instead of lower-level <<saved-objects-api, saved objects API>>.

The following data views APIs are available:

* Data views
** <<data-views-api-get, Get data view API>> to retrieve a single data view
** <<data-views-api-create, Create data view API>> to create data view
** <<data-views-api-update, Update data view API>> to partially updated data view
** <<data-views-api-delete, Delete data view API>> to delete a data view
* Default data views
** <<data-views-api-default-get, Get default data view API>> to retrieve a default data view
** <<data-views-api-default-set, Set default data view API>> to set a default data view
* Fields
** <<data-views-fields-api-update, Update data view field>> to change field metadata, such as `count`, `customLabel` and `format`
* Runtime fields
** <<data-views-runtime-field-api-get, Get runtime field API>> to retrieve a runtime field
** <<data-views-runtime-field-api-create, Create runtime field API>> to create a runtime field
** <<data-views-runtime-field-api-upsert, Upsert runtime field API>> to create or update a runtime field
** <<data-views-runtime-field-api-update, Update runtime field API>> to partially update an existing runtime field
** <<data-views-runtime-field-api-delete, Delete runtime field API>> to delete a runtime field

include::data-views/get.asciidoc[]
include::data-views/create.asciidoc[]
include::data-views/update.asciidoc[]
include::data-views/delete.asciidoc[]
include::data-views/default-get.asciidoc[]
include::data-views/default-set.asciidoc[]
include::data-views/update-fields.asciidoc[]
include::data-views/runtime-fields/get.asciidoc[]
include::data-views/runtime-fields/create.asciidoc[]
include::data-views/runtime-fields/upsert.asciidoc[]
include::data-views/runtime-fields/update.asciidoc[]
include::data-views/runtime-fields/delete.asciidoc[]

Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
[[index-patterns-api-create]]
=== Create index pattern API
[[data-views-api-create]]
=== Create data view API
++++
<titleabbrev>Create index pattern</titleabbrev>
<titleabbrev>Create data view</titleabbrev>
++++

experimental[] Create {kib} index patterns.
experimental[] Create data views.

[[index-patterns-api-create-request]]
[[data-views-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]]
[[data-views-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]]
[[data-views-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`.
`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 index pattern fields after
the index pattern is stored. 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 index pattern object. All fields are optional.
`index_pattern`:: (Required, object) The data view object. All fields are optional.

[[index-patterns-api-create-request-codes]]
[[data-views-api-create-request-codes]]
==== Response code

`200`::
Indicates a successful call.

[[index-patterns-api-create-example]]
[[data-views-api-create-example]]
==== Examples

Create an index pattern with a custom title:
Create a data view with a custom title:

[source,sh]
--------------------------------------------------
Expand Down Expand Up @@ -67,7 +67,7 @@ $ curl -X POST api/index_patterns/index_pattern
--------------------------------------------------
// KIBANA

At creation, all index pattern fields are optional:
At creation, all data view fields are optional:

[source,sh]
--------------------------------------------------
Expand All @@ -92,7 +92,7 @@ $ curl -X POST api/index_patterns/index_pattern
// KIBANA


The API returns the index pattern object:
The API returns the data view object:

[source,sh]
--------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
[[index-patterns-api-default-get]]
=== Get default index pattern API
[[data-views-api-default-get]]
=== Get default data view API
++++
<titleabbrev>Get default index pattern</titleabbrev>
<titleabbrev>Get default data view</titleabbrev>
++++

experimental[] Retrieve a default index pattern ID. Kibana UI uses default index pattern unless user picks a different one.
experimental[] Retrieve a default data view ID. Kibana UI uses the default data view unless user picks a different one.

[[index-patterns-api-default-get-request]]
[[data-views-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]]
[[data-views-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]]
[[data-views-api-default-get-codes]]
==== Response code

`200`::
Indicates a successful call.

[[index-patterns-api-default-get-example]]
[[data-views-api-default-get-example]]
==== Example

Retrieve the default index pattern id:
Retrieve the default data view id:

[source,sh]
--------------------------------------------------
$ curl -X GET api/index_patterns/default
--------------------------------------------------
// KIBANA

The API returns an ID of a default index pattern:
The API returns an ID of a default data view:

[source,sh]
--------------------------------------------------
Expand All @@ -45,7 +45,7 @@ The API returns an ID of a default index pattern:
}
--------------------------------------------------

In case there is no default index pattern, the API returns:
In case there is no default data view, the API returns:

[source,sh]
--------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
[[index-patterns-api-default-set]]
=== Set default index pattern API
[[data-views-api-default-set]]
=== Set default data view API
++++
<titleabbrev>Set default index pattern</titleabbrev>
<titleabbrev>Set default data view</titleabbrev>
++++

experimental[] Set a default index pattern ID. Kibana UI will use default index pattern unless user picks a different one.
experimental[] Set a default data view ID. Kibana UI will use the default data view 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]]
[[data-views-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]]
[[data-views-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]]
[[data-views-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.
`index_pattern_id`:: (Required, `string` or `null`) Sets a default data view id. Use `null` to unset a default data view.

`force`:: (Optional, boolean) Updates existing default index pattern id. The default is `false`.
`force`:: (Optional, boolean) Updates existing default data view id. The default is `false`.


[[index-patterns-api-default-set-codes]]
[[data-views-api-default-set-codes]]
==== Response code

`200`::
Indicates a successful call.

[[index-patterns-api-default-set-example]]
[[data-views-api-default-set-example]]
==== Example

Set the default index pattern id if none is set:
Set the default data view id if none is set:

[source,sh]
--------------------------------------------------
Expand All @@ -49,7 +49,7 @@ $ curl -X POST api/index_patterns/default
// KIBANA


Upsert the default index pattern:
Upsert the default data view:

[source,sh]
--------------------------------------------------
Expand All @@ -61,7 +61,7 @@ $ curl -X POST api/index_patterns/default
--------------------------------------------------
// KIBANA

Unset the default index pattern:
Unset the default data view:

[source,sh]
--------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
[[index-patterns-api-delete]]
=== Delete index pattern API
[[data-views-api-delete]]
=== Delete data view API
++++
<titleabbrev>Delete index pattern</titleabbrev>
<titleabbrev>Delete data view</titleabbrev>
++++

experimental[] Delete {kib} index patterns.
experimental[] Delete data views.

WARNING: Once you delete an index pattern, _it cannot be recovered_.
WARNING: Once you delete a data view, _it cannot be recovered_.

[[index-patterns-api-delete-request]]
[[data-views-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]]
[[data-views-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.
(Required, string) The ID of the data view you want to delete.

[[index-patterns-api-delete-response-codes]]
[[data-views-api-delete-response-codes]]
==== Response code

`200`::
Indicates that index pattern is deleted. Returns an empty response body.
Indicates that data view is deleted. Returns an empty response body.

==== Example

Delete an index pattern object with the `my-pattern` ID:
Delete a data view object with the `my-pattern` ID:

[source,sh]
--------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
[[index-patterns-api-get]]
=== Get index pattern API
[[data-views-api-get]]
=== Get data view API
++++
<titleabbrev>Get index pattern</titleabbrev>
<titleabbrev>Get data view</titleabbrev>
++++

experimental[] Retrieve a single {kib} index pattern by ID.
experimental[] Retrieve a single data view by ID.

[[index-patterns-api-get-request]]
[[data-views-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]]
[[data-views-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.
(Required, string) The ID of the data view you want to retrieve.

[[index-patterns-api-get-codes]]
[[data-views-api-get-codes]]
==== Response code

`200`::
Indicates a successful call.

`404`::
The specified index pattern and ID doesn't exist.
The specified data view and ID doesn't exist.

[[index-patterns-api-get-example]]
[[data-views-api-get-example]]
==== Example

Retrieve the index pattern object with the `my-pattern` ID:
Retrieve the data view 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:
The API returns a data view object:

[source,sh]
--------------------------------------------------
Expand Down
Loading

0 comments on commit eb4fb72

Please sign in to comment.