From daaa778482c152684f4cd73bc8f2fda87c8a9048 Mon Sep 17 00:00:00 2001 From: lcawl Date: Mon, 6 Jan 2025 10:05:37 -0800 Subject: [PATCH] Add examples for simulate APIs --- output/openapi/elasticsearch-openapi.json | 4 ++-- .../openapi/elasticsearch-serverless-openapi.json | 4 ++-- output/schema/schema.json | 13 +++++++------ specification/_doc_ids/table.csv | 1 + .../IndicesSimulateIndexTemplateRequest.ts | 2 +- .../indicesSimulateIndexResponseExample1.yaml | 13 +++++++++++++ .../IndicesSimulateTemplateRequest.ts | 3 ++- .../indicesSimulateTemplateRequestExample1.yaml | 9 +++++++++ .../indicesSimulateTemplateResponseExample2.yaml | 14 ++++++++++++++ 9 files changed, 51 insertions(+), 12 deletions(-) create mode 100644 specification/indices/simulate_index_template/indicesSimulateIndexResponseExample1.yaml create mode 100644 specification/indices/simulate_template/indicesSimulateTemplateRequestExample1.yaml create mode 100644 specification/indices/simulate_template/indicesSimulateTemplateResponseExample2.yaml diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 1e9c923d3c..58aa56bd91 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -14706,7 +14706,7 @@ "indices" ], "summary": "Simulate an index template", - "description": "Returns the index configuration that would be applied by a particular index template.", + "description": "Get the index configuration that would be applied by a particular index template.", "operationId": "indices-simulate-template", "parameters": [ { @@ -14735,7 +14735,7 @@ "indices" ], "summary": "Simulate an index template", - "description": "Returns the index configuration that would be applied by a particular index template.", + "description": "Get the index configuration that would be applied by a particular index template.", "operationId": "indices-simulate-template-1", "parameters": [ { diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 633b46864d..8285cf294a 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -8251,7 +8251,7 @@ "indices" ], "summary": "Simulate an index template", - "description": "Returns the index configuration that would be applied by a particular index template.", + "description": "Get the index configuration that would be applied by a particular index template.", "operationId": "indices-simulate-template", "parameters": [ { @@ -8280,7 +8280,7 @@ "indices" ], "summary": "Simulate an index template", - "description": "Returns the index configuration that would be applied by a particular index template.", + "description": "Get the index configuration that would be applied by a particular index template.", "operationId": "indices-simulate-template-1", "parameters": [ { diff --git a/output/schema/schema.json b/output/schema/schema.json index f45e48b507..81f51301c5 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -8263,8 +8263,8 @@ } }, "description": "Simulate an index.\nGet the index configuration that would be applied to the specified index from an existing index template.", - "docId": "indices-simulate-template", - "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-simulate-template.html", + "docId": "indices-simulate", + "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/{master}/indices-simulate-index.html", "name": "indices.simulate_index_template", "privileges": { "cluster": [ @@ -8305,8 +8305,9 @@ "stability": "stable" } }, - "description": "Simulate an index template.\nReturns the index configuration that would be applied by a particular index template.", - "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-template.html", + "description": "Simulate an index template.\nGet the index configuration that would be applied by a particular index template.", + "docId": "indices-simulate-template", + "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-simulate-template.html", "name": "indices.simulate_template", "privileges": { "cluster": [ @@ -139591,7 +139592,7 @@ } ] }, - "description": "Simulate an index template.\nReturns the index configuration that would be applied by a particular index template.", + "description": "Simulate an index template.\nGet the index configuration that would be applied by a particular index template.", "inherits": { "type": { "name": "RequestBase", @@ -139666,7 +139667,7 @@ } } ], - "specLocation": "indices/simulate_template/IndicesSimulateTemplateRequest.ts#L27-L120" + "specLocation": "indices/simulate_template/IndicesSimulateTemplateRequest.ts#L27-L121" }, { "kind": "response", diff --git a/specification/_doc_ids/table.csv b/specification/_doc_ids/table.csv index 6f42100d70..0ca0db22ba 100644 --- a/specification/_doc_ids/table.csv +++ b/specification/_doc_ids/table.csv @@ -266,6 +266,7 @@ indices-rollover-index,https://www.elastic.co/guide/en/elasticsearch/reference/{ indices-segments,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-segments.html indices-shards-stores,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-shards-stores.html indices-shrink-index,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-shrink-index.html +indices-simulate,https://www.elastic.co/guide/en/elasticsearch/reference/{master}/indices-simulate-index.html indices-simulate-template,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-simulate-template.html indices-split-index,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-split-index.html indices-stats,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-stats.html diff --git a/specification/indices/simulate_index_template/IndicesSimulateIndexTemplateRequest.ts b/specification/indices/simulate_index_template/IndicesSimulateIndexTemplateRequest.ts index ea76f6552b..9a7c77d352 100644 --- a/specification/indices/simulate_index_template/IndicesSimulateIndexTemplateRequest.ts +++ b/specification/indices/simulate_index_template/IndicesSimulateIndexTemplateRequest.ts @@ -27,7 +27,7 @@ import { Duration } from '@_types/Time' * @rest_spec_name indices.simulate_index_template * @availability stack since=7.9.0 stability=stable * @availability serverless stability=stable visibility=public - * @doc_id indices-simulate-template + * @doc_id indices-simulate * @cluster_privileges manage_index_templates */ export interface Request extends RequestBase { diff --git a/specification/indices/simulate_index_template/indicesSimulateIndexResponseExample1.yaml b/specification/indices/simulate_index_template/indicesSimulateIndexResponseExample1.yaml new file mode 100644 index 0000000000..fcf0504ead --- /dev/null +++ b/specification/indices/simulate_index_template/indicesSimulateIndexResponseExample1.yaml @@ -0,0 +1,13 @@ +# summary: indices/simulate-index.asciidoc:188 +description: A successful response from `POST /_index_template/_simulate_index/my-index-000001`. +# type: response +# response_code: 200 +value: "{\n \"template\" : {\n \"settings\" : {\n \"index\" : {\n \ + \ \"number_of_shards\" : \"2\",\n \"number_of_replicas\" : \"0\",\n \ + \ \"routing\" : {\n \"allocation\" : {\n \"include\" : {\n\ + \ \"_tier_preference\" : \"data_content\"\n }\n \ + \ }\n }\n }\n },\n \"mappings\" : {\n \"properties\" : {\n\ + \ \"@timestamp\" : {\n \"type\" : \"date\"\n }\n }\n\ + \ },\n \"aliases\" : { }\n },\n \"overlapping\" : [\n {\n \"name\"\ + \ : \"template_1\",\n \"index_patterns\" : [\n \"my-index-*\"\n \ + \ ]\n }\n ]\n}" diff --git a/specification/indices/simulate_template/IndicesSimulateTemplateRequest.ts b/specification/indices/simulate_template/IndicesSimulateTemplateRequest.ts index 2352c5653a..f55fee9643 100644 --- a/specification/indices/simulate_template/IndicesSimulateTemplateRequest.ts +++ b/specification/indices/simulate_template/IndicesSimulateTemplateRequest.ts @@ -26,11 +26,12 @@ import { Duration } from '@_types/Time' /** * Simulate an index template. - * Returns the index configuration that would be applied by a particular index template. + * Get the index configuration that would be applied by a particular index template. * @rest_spec_name indices.simulate_template * @availability stack stability=stable * @availability serverless stability=stable visibility=public * @cluster_privileges manage_index_templates + * @doc_id indices-simulate-template */ export interface Request extends RequestBase { path_parts: { diff --git a/specification/indices/simulate_template/indicesSimulateTemplateRequestExample1.yaml b/specification/indices/simulate_template/indicesSimulateTemplateRequestExample1.yaml new file mode 100644 index 0000000000..6deade552d --- /dev/null +++ b/specification/indices/simulate_template/indicesSimulateTemplateRequestExample1.yaml @@ -0,0 +1,9 @@ +# summary: +# method_request: POST /_index_template/_simulate +description: > + To see what settings will be applied by a template before you add it to the cluster, you can pass a template configuration in the request body. + The specified template is used for the simulation if it has a higher priority than existing templates. +# type: request +value: "{\n \"index_patterns\": [\"my-index-*\"],\n \"composed_of\": [\"ct2\"],\n\ + \ \"priority\": 10,\n \"template\": {\n \"settings\": {\n \"index.number_of_replicas\"\ + : 1\n }\n }\n}" diff --git a/specification/indices/simulate_template/indicesSimulateTemplateResponseExample2.yaml b/specification/indices/simulate_template/indicesSimulateTemplateResponseExample2.yaml new file mode 100644 index 0000000000..0c6dfed6f1 --- /dev/null +++ b/specification/indices/simulate_template/indicesSimulateTemplateResponseExample2.yaml @@ -0,0 +1,14 @@ +# summary: +description: > + A successful response from `POST /_index_template/_simulate` with a template configuration in the request body. + The response shows any overlapping templates with a lower priority. +# type: response +# response_code: 200 +value: "{\n \"template\" : {\n \"settings\" : {\n \"index\" : {\n \ + \ \"number_of_replicas\" : \"1\",\n \"routing\" : {\n \"allocation\"\ + \ : {\n \"include\" : {\n \"_tier_preference\" : \"data_content\"\ + \n }\n }\n }\n }\n },\n \"mappings\" : {\n\ + \ \"properties\" : {\n \"@timestamp\" : {\n \"type\" : \"date\"\ + \n }\n }\n },\n \"aliases\" : { }\n },\n \"overlapping\" : [\n\ + \ {\n \"name\" : \"final-template\",\n \"index_patterns\" : [\n \ + \ \"my-index-*\"\n ]\n }\n ]\n}"