Skip to content

Commit

Permalink
create runtime field
Browse files Browse the repository at this point in the history
  • Loading branch information
amyjtechwriter committed Aug 14, 2023
1 parent 384a1f1 commit b30f481
Show file tree
Hide file tree
Showing 6 changed files with 221 additions and 2 deletions.
97 changes: 97 additions & 0 deletions src/plugins/data_views/docs/openapi/bundled.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,80 @@
}
]
},
"/api/data_views/data_view/{viewId}/runtime_field": {
"post": {
"summary": "Creates a runtime field.",
"operationId": "createRuntimeField",
"description": "This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.\n",
"tags": [
"data views"
],
"parameters": [
{
"$ref": "#/components/parameters/kbn_xsrf"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data_view_id": {
"description": "The ID of the data view.",
"type": "string",
"required": true
},
"space_id": {
"description": "An identifier for the space. If space_id is not provided in the URL, the default space is used.",
"type": "string",
"required": false
}
}
},
"examples": {
"createRuntimeFieldRequest": {
"$ref": "#/components/examples/create_runtime_field_request"
}
}
}
}
},
"responses": {
"200": {
"description": "Indicates a successful call.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/create_runtime_field_response"
}
}
}
},
"400": {
"description": "Bad request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/400_response"
}
}
}
}
},
"servers": [
{
"url": "https://localhost:5601"
}
]
},
"servers": [
{
"url": "https://localhost:5601"
}
]
},
"/api/data_views/data_view/{viewId}/runtime_field/{fieldName}": {
"get": {
"summary": "Retrieves a runtime field.",
Expand Down Expand Up @@ -1690,6 +1764,18 @@
"refresh_fields": true
}
},
"create_runtime_field_request": {
"summary": "Create a runtime field.",
"value": {
"name": "runtimeFoo",
"runtimeField": {
"type": "long",
"script": {
"source": "emit(doc[\"foo\"].value)"
}
}
}
},
"get_runtime_field_response": {
"summary": "The get runtime field API returns a JSON object that contains information about the runtime field (`hour_of_day`) and the data view (`d3d7af60-4c81-11e8-b3d7-01146121b73d`).",
"value": {
Expand Down Expand Up @@ -2611,6 +2697,17 @@
"default": false
}
}
},
"create_runtime_field_response": {
"summary": "The API returns created runtime field object array and updated data view object.",
"value": {
"data_view": {
"...": null
},
"fields": [
"..."
]
}
}
}
}
Expand Down
60 changes: 60 additions & 0 deletions src/plugins/data_views/docs/openapi/bundled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,51 @@ paths:
- url: https://localhost:5601
servers:
- url: https://localhost:5601
/api/data_views/data_view/{viewId}/runtime_field:
post:
summary: Creates a runtime field.
operationId: createRuntimeField
description: |
This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
tags:
- data views
parameters:
- $ref: '#/components/parameters/kbn_xsrf'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
data_view_id:
description: The ID of the data view.
type: string
required: true
space_id:
description: An identifier for the space. If space_id is not provided in the URL, the default space is used.
type: string
required: false
examples:
createRuntimeFieldRequest:
$ref: '#/components/examples/create_runtime_field_request'
responses:
'200':
description: Indicates a successful call.
content:
application/json:
schema:
$ref: '#/components/schemas/create_runtime_field_response'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/400_response'
servers:
- url: https://localhost:5601
servers:
- url: https://localhost:5601
/api/data_views/data_view/{viewId}/runtime_field/{fieldName}:
get:
summary: Retrieves a runtime field.
Expand Down Expand Up @@ -1253,6 +1298,14 @@ components:
allowNoIndex: false
name: Kibana Sample Data eCommerce
refresh_fields: true
create_runtime_field_request:
summary: Create a runtime field.
value:
name: runtimeFoo
runtimeField:
type: long
script:
source: emit(doc["foo"].value)
get_runtime_field_response:
summary: The get runtime field API returns a JSON object that contains information about the runtime field (`hour_of_day`) and the data view (`d3d7af60-4c81-11e8-b3d7-01146121b73d`).
value:
Expand Down Expand Up @@ -1967,3 +2020,10 @@ components:
type: boolean
description: Reloads the data view fields after the data view is updated.
default: false
create_runtime_field_response:
summary: The API returns created runtime field object array and updated data view object.
value:
data_view:
...: null
fields:
- ...
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
summary: Create a runtime field.
value:
{
"name": "runtimeFoo",
"runtimeField": {
"type": "long",
"script": {
"source": 'emit(doc["foo"].value)'
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
summary: The API returns created runtime field object array and updated data view object.
value:
{
"data_view": {...},
"fields": [...]
}
4 changes: 2 additions & 2 deletions src/plugins/data_views/docs/openapi/entrypoint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ paths:
$ref: 'paths/api@data_views@data_view@{viewid}.yaml'
# '/api/data_views/data_view/{viewId}/fields':
# $ref: 'paths/api@data_views@data_view@{viewid}@fields.yaml'
# '/api/data_views/data_view/{viewId}/runtime_field':
# $ref: 'paths/api@data_views@data_view@{viewid}@runtime_field.yaml'
'/api/data_views/data_view/{viewId}/runtime_field':
$ref: 'paths/api@data_views@data_view@{viewid}@runtime_field.yaml'
'/api/data_views/data_view/{viewId}/runtime_field/{fieldName}':
$ref: 'paths/api@data_views@data_view@{viewid}@runtime_field@{fieldname}.yaml'
'/api/data_views/default':
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
post:
summary: Creates a runtime field.
operationId: createRuntimeField
description: >
This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
tags:
- data views
parameters:
- $ref: '../components/headers/kbn_xsrf.yaml'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
data_view_id:
description: The ID of the data view.
type: string
required: true
space_id:
description: An identifier for the space. If space_id is not provided in the URL, the default space is used.
type: string
required: false
examples:
createRuntimeFieldRequest:
$ref: '../components/examples/create_runtime_field_request.yaml'
responses:
'200':
description: Indicates a successful call.
content:
application/json:
schema:
$ref: '../components/examples/create_runtime_field_response.yaml'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '../components/schemas/400_response.yaml'
servers:
- url: https://localhost:5601

servers:
- url: https://localhost:5601

0 comments on commit b30f481

Please sign in to comment.