-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Index Patterns] Runtime fields CRUD REST API (#101164)
Part of index pattern REST API
- Loading branch information
Showing
59 changed files
with
1,993 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
[[index-patterns-runtime-field-api-create]] | ||
=== Create runtime field API | ||
++++ | ||
<titleabbrev>Create runtime field</titleabbrev> | ||
++++ | ||
|
||
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": {...} | ||
} | ||
-------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
[[index-patterns-runtime-field-api-delete]] | ||
=== Delete runtime field API | ||
++++ | ||
<titleabbrev>Delete runtime field</titleabbrev> | ||
++++ | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
[[index-patterns-runtime-field-api-get]] | ||
=== Get runtime field API | ||
++++ | ||
<titleabbrev>Get runtime field</titleabbrev> | ||
++++ | ||
|
||
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": { | ||
... | ||
} | ||
} | ||
-------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
[[index-patterns-runtime-field-api-update]] | ||
=== Update runtime field API | ||
++++ | ||
<titleabbrev>Update runtime field</titleabbrev> | ||
++++ | ||
|
||
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": {...} | ||
} | ||
-------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
[[index-patterns-runtime-field-api-upsert]] | ||
=== Upsert runtime field API | ||
++++ | ||
<titleabbrev>Upsert runtime field</titleabbrev> | ||
++++ | ||
|
||
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": {...} | ||
} | ||
-------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...s/data/public/kibana-plugin-plugins-data-public.indexpattern.getruntimefield.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [getRuntimeField](./kibana-plugin-plugins-data-public.indexpattern.getruntimefield.md) | ||
|
||
## IndexPattern.getRuntimeField() method | ||
|
||
Returns runtime field if exists | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
getRuntimeField(name: string): RuntimeField | null; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| name | <code>string</code> | | | ||
|
||
<b>Returns:</b> | ||
|
||
`RuntimeField | null` | ||
|
24 changes: 24 additions & 0 deletions
24
...s/data/public/kibana-plugin-plugins-data-public.indexpattern.hasruntimefield.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [hasRuntimeField](./kibana-plugin-plugins-data-public.indexpattern.hasruntimefield.md) | ||
|
||
## IndexPattern.hasRuntimeField() method | ||
|
||
Checks if runtime field exists | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
hasRuntimeField(name: string): boolean; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| name | <code>string</code> | | | ||
|
||
<b>Returns:</b> | ||
|
||
`boolean` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.