diff --git a/docs/overlays/elasticsearch-openapi-overlays.yaml b/docs/overlays/elasticsearch-openapi-overlays.yaml index 2e6e694dec..b076e3941f 100644 --- a/docs/overlays/elasticsearch-openapi-overlays.yaml +++ b/docs/overlays/elasticsearch-openapi-overlays.yaml @@ -394,6 +394,7 @@ actions: examples: indicesLegacyPutTemplateRequestExample1: $ref: "../../specification/indices/put_template/indicesPutTemplateRequestExample1.yaml" + ## Examples for behavioral analytics - target: "$.paths['/_application/analytics/{collection_name}/event/{event_type}']['post']" description: "Add examples for post analytics collection event operation" @@ -404,6 +405,17 @@ actions: examples: postBehavioralAnalyticsEventRequestExample1: $ref: "../../specification/search_application/post_behavioral_analytics_event/BehavioralAnalyticsEventPostRequestExample1.yaml" +## Examples for indices + - target: "$.paths['/_lifecycle/stats']['get']" + description: "Add examples for get lifecycle stats operation" + update: + responses: + 200: + content: + application/json: + examples: + dataStreamLifecycleStatsResponseExample1: + $ref: "../../specification/indices/get_data_lifecycle_stats/examples/response/IndicesGetDataLifecycleStatsResponseExample1.yaml" ## Examples for licensing - target: "$.paths['/_license/basic_status']['get']" description: "Add example for get basic status response" diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 1ecf1757fd..4cb2ee5a22 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -13276,6 +13276,52 @@ } } }, + "/_lifecycle/stats": { + "get": { + "tags": [ + "data stream" + ], + "summary": "Get data stream lifecycle stats", + "description": "Get statistics about the data streams that are managed by a data stream lifecycle.", + "operationId": "indices-get-data-lifecycle-stats", + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data_stream_count": { + "description": "The count of data streams currently being managed by the data stream lifecycle.", + "type": "number" + }, + "data_streams": { + "description": "Information about the data streams that are managed by the data stream lifecycle.", + "type": "array", + "items": { + "$ref": "#/components/schemas/indices.get_data_lifecycle_stats:DataStreamStats" + } + }, + "last_run_duration_in_millis": { + "$ref": "#/components/schemas/_types:DurationValueUnitMillis" + }, + "time_between_starts_in_millis": { + "$ref": "#/components/schemas/_types:DurationValueUnitMillis" + } + }, + "required": [ + "data_stream_count", + "data_streams" + ] + } + } + } + } + }, + "x-state": "Added in 8.12.0" + } + }, "/_data_stream": { "get": { "tags": [ @@ -69596,6 +69642,27 @@ "name" ] }, + "indices.get_data_lifecycle_stats:DataStreamStats": { + "type": "object", + "properties": { + "backing_indices_in_error": { + "description": "The count of the backing indices for the data stream.", + "type": "number" + }, + "backing_indices_in_total": { + "description": "The count of the backing indices for the data stream that have encountered an error.", + "type": "number" + }, + "name": { + "$ref": "#/components/schemas/_types:DataStreamName" + } + }, + "required": [ + "backing_indices_in_error", + "backing_indices_in_total", + "name" + ] + }, "indices._types:DataStream": { "type": "object", "properties": { diff --git a/output/schema/schema.json b/output/schema/schema.json index b749f60ba4..5ae627335c 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -7174,6 +7174,44 @@ } ] }, + { + "availability": { + "stack": { + "since": "8.12.0", + "stability": "stable" + } + }, + "description": "Get data stream lifecycle stats.\nGet statistics about the data streams that are managed by a data stream lifecycle.", + "docId": "data-stream-lifecycle-stats", + "docTag": "data stream", + "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/data-streams-get-lifecycle-stats.html", + "name": "indices.get_data_lifecycle_stats", + "privileges": { + "cluster": [ + "monitor" + ] + }, + "request": { + "name": "Request", + "namespace": "indices.get_data_lifecycle_stats" + }, + "requestBodyRequired": false, + "response": { + "name": "Response", + "namespace": "indices.get_data_lifecycle_stats" + }, + "responseMediaType": [ + "application/json" + ], + "urls": [ + { + "methods": [ + "GET" + ], + "path": "/_lifecycle/stats" + } + ] + }, { "availability": { "serverless": { @@ -133847,6 +133885,157 @@ }, "specLocation": "indices/get_data_lifecycle/IndicesGetDataLifecycleResponse.ts#L23-L25" }, + { + "kind": "interface", + "name": { + "name": "DataStreamStats", + "namespace": "indices.get_data_lifecycle_stats" + }, + "properties": [ + { + "description": "The count of the backing indices for the data stream.", + "name": "backing_indices_in_error", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "description": "The count of the backing indices for the data stream that have encountered an error.", + "name": "backing_indices_in_total", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "description": "The name of the data stream.", + "name": "name", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "DataStreamName", + "namespace": "_types" + } + } + } + ], + "specLocation": "indices/get_data_lifecycle_stats/IndicesGetDataLifecycleStatsResponse.ts#L46-L59" + }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "no_body" + }, + "description": "Get data stream lifecycle stats.\nGet statistics about the data streams that are managed by a data stream lifecycle.", + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "indices.get_data_lifecycle_stats" + }, + "path": [], + "query": [], + "specLocation": "indices/get_data_lifecycle_stats/IndicesGetDataLifecycleStatsRequest.ts#L22-L31" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [ + { + "description": "The count of data streams currently being managed by the data stream lifecycle.", + "name": "data_stream_count", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "description": "Information about the data streams that are managed by the data stream lifecycle.", + "name": "data_streams", + "required": true, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "DataStreamStats", + "namespace": "indices.get_data_lifecycle_stats" + } + } + } + }, + { + "description": "The duration of the last data stream lifecycle execution.", + "name": "last_run_duration_in_millis", + "required": false, + "type": { + "kind": "instance_of", + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "UnitMillis", + "namespace": "_types" + } + } + ], + "type": { + "name": "DurationValue", + "namespace": "_types" + } + } + }, + { + "description": "The time that passed between the start of the last two data stream lifecycle executions.\nThis value should amount approximately to `data_streams.lifecycle.poll_interval`.", + "name": "time_between_starts_in_millis", + "required": false, + "type": { + "kind": "instance_of", + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "UnitMillis", + "namespace": "_types" + } + } + ], + "type": { + "name": "DurationValue", + "namespace": "_types" + } + } + } + ] + }, + "name": { + "name": "Response", + "namespace": "indices.get_data_lifecycle_stats" + }, + "specLocation": "indices/get_data_lifecycle_stats/IndicesGetDataLifecycleStatsResponse.ts#L24-L44" + }, { "kind": "request", "attachedBehaviors": [ diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 493e5aa2d8..f78d597e45 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -11913,6 +11913,22 @@ export interface IndicesGetDataLifecycleResponse { data_streams: IndicesGetDataLifecycleDataStreamWithLifecycle[] } +export interface IndicesGetDataLifecycleStatsDataStreamStats { + backing_indices_in_error: integer + backing_indices_in_total: integer + name: DataStreamName +} + +export interface IndicesGetDataLifecycleStatsRequest extends RequestBase { +} + +export interface IndicesGetDataLifecycleStatsResponse { + data_stream_count: integer + data_streams: IndicesGetDataLifecycleStatsDataStreamStats[] + last_run_duration_in_millis?: DurationValue + time_between_starts_in_millis?: DurationValue +} + export interface IndicesGetDataStreamRequest extends RequestBase { name?: DataStreamNames expand_wildcards?: ExpandWildcards diff --git a/specification/_doc_ids/table.csv b/specification/_doc_ids/table.csv index 4350c00333..16cc1d4434 100644 --- a/specification/_doc_ids/table.csv +++ b/specification/_doc_ids/table.csv @@ -124,6 +124,7 @@ dangling-index-delete,https://www.elastic.co/guide/en/elasticsearch/reference/{b dangling-index-import,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/dangling-index-import.html dangling-indices-list,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/dangling-indices-list.html data-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/date-processor.html +data-stream-lifecycle-stats,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/data-streams-get-lifecycle-stats.html data-stream-path-param,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-create-data-stream.html#indices-create-data-stream-api-path-params data-streams,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/data-streams.html date-index-name-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/date-index-name-processor.html diff --git a/specification/_json_spec/indices.get_data_lifecycle_stats.json b/specification/_json_spec/indices.get_data_lifecycle_stats.json new file mode 100644 index 0000000000..8c9e947903 --- /dev/null +++ b/specification/_json_spec/indices.get_data_lifecycle_stats.json @@ -0,0 +1,21 @@ +{ + "indices.get_data_lifecycle_stats": { + "documentation": { + "url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams-get-lifecycle-stats.html", + "description": "Get data stream lifecycle statistics." + }, + "stability": "stable", + "visibility": "public", + "headers": { + "accept": ["application/json"] + }, + "url": { + "paths": [ + { + "path": "/_lifecycle/stats", + "methods": ["GET"] + } + ] + } + } +} diff --git a/specification/indices/get_data_lifecycle_stats/IndicesGetDataLifecycleStatsRequest.ts b/specification/indices/get_data_lifecycle_stats/IndicesGetDataLifecycleStatsRequest.ts new file mode 100644 index 0000000000..5cb0a33b7c --- /dev/null +++ b/specification/indices/get_data_lifecycle_stats/IndicesGetDataLifecycleStatsRequest.ts @@ -0,0 +1,31 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { RequestBase } from '@_types/Base' + +/** + * Get data stream lifecycle stats. + * Get statistics about the data streams that are managed by a data stream lifecycle. + * @rest_spec_name indices.get_data_lifecycle_stats + * @availability stack since=8.12.0 stability=stable + * @cluster_privileges monitor + * @doc_tag data stream + * @doc_id data-stream-lifecycle-stats + */ +export interface Request extends RequestBase {} diff --git a/specification/indices/get_data_lifecycle_stats/IndicesGetDataLifecycleStatsResponse.ts b/specification/indices/get_data_lifecycle_stats/IndicesGetDataLifecycleStatsResponse.ts new file mode 100644 index 0000000000..54a43b7dd7 --- /dev/null +++ b/specification/indices/get_data_lifecycle_stats/IndicesGetDataLifecycleStatsResponse.ts @@ -0,0 +1,59 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { DataStreamName } from '@_types/common' +import { integer } from '@_types/Numeric' +import { DurationValue, UnitMillis } from '@_types/Time' + +export class Response { + body: { + /** + * The count of data streams currently being managed by the data stream lifecycle. + */ + data_stream_count: integer + /** + * Information about the data streams that are managed by the data stream lifecycle. + */ + data_streams: DataStreamStats[] + /** + * The duration of the last data stream lifecycle execution. + */ + last_run_duration_in_millis?: DurationValue + /** + * The time that passed between the start of the last two data stream lifecycle executions. + * This value should amount approximately to `data_streams.lifecycle.poll_interval`. + */ + time_between_starts_in_millis?: DurationValue + } +} + +class DataStreamStats { + /** + * The count of the backing indices for the data stream. + */ + backing_indices_in_error: integer + /** + * The count of the backing indices for the data stream that have encountered an error. + */ + backing_indices_in_total: integer + /** + * The name of the data stream. + */ + name: DataStreamName +} diff --git a/specification/indices/get_data_lifecycle_stats/examples/response/IndicesGetDataLifecycleStatsResponseExample1.yaml b/specification/indices/get_data_lifecycle_stats/examples/response/IndicesGetDataLifecycleStatsResponseExample1.yaml new file mode 100644 index 0000000000..04a9ff05ee --- /dev/null +++ b/specification/indices/get_data_lifecycle_stats/examples/response/IndicesGetDataLifecycleStatsResponseExample1.yaml @@ -0,0 +1,17 @@ +# summary: +description: A successful response for `GET _lifecycle/stats?human&pretty` +# type: response +# response_code: 200 +value: + last_run_duration_in_millis: 2 + last_run_duration: 2ms + time_between_starts_in_millis: 9998 + time_between_starts: 9.99s + data_streams_count: 2 + data_streams: + - name: my-data-stream + backing_indices_in_total: 2 + backing_indices_in_error: 0 + - name: my-other-stream + backing_indices_in_total: 2 + backing_indices_in_error: 1