From 6f36664f86552572005be6f9300fb5693861d56c Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Tue, 23 Sep 2025 22:22:08 -0700 Subject: [PATCH] Fix alias examples (#5331) * Fix alias API examples * Generate output * Format yaml (cherry picked from commit 2a84c0ca0dd45f8806158d011748fe2c20b2547c) --- output/openapi/elasticsearch-openapi.json | 34 +++++++++++++- .../elasticsearch-serverless-openapi.json | 34 +++++++++++++- output/schema/schema.json | 27 +++++++++-- specification/_doc_ids/table.csv | 5 +- .../put_alias/IndicesPutAliasRequest.ts | 1 + .../indicesPutAliasRequestExample1.yaml | 47 ++++++++++--------- .../indicesPutAliasRequestExample2.yaml | 10 ++++ .../indicesPutAliasRequestExample3.yaml | 8 ++++ 8 files changed, 135 insertions(+), 31 deletions(-) create mode 100644 specification/indices/put_alias/examples/request/indicesPutAliasRequestExample2.yaml create mode 100644 specification/indices/put_alias/examples/request/indicesPutAliasRequestExample3.yaml diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 528c3f3896..9ee90e51d5 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -14911,6 +14911,11 @@ ], "summary": "Create or update an alias", "description": "Adds a data stream or index to an alias.", + "externalDocs": { + "description": "Aliases", + "url": "https://www.elastic.co/docs/manage-data/data-store/aliases", + "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/indices-add-alias.html" + }, "operationId": "indices-put-alias", "parameters": [ { @@ -14948,6 +14953,11 @@ ], "summary": "Create or update an alias", "description": "Adds a data stream or index to an alias.", + "externalDocs": { + "description": "Aliases", + "url": "https://www.elastic.co/docs/manage-data/data-store/aliases", + "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/indices-add-alias.html" + }, "operationId": "indices-put-alias-1", "parameters": [ { @@ -15061,6 +15071,11 @@ ], "summary": "Create or update an alias", "description": "Adds a data stream or index to an alias.", + "externalDocs": { + "description": "Aliases", + "url": "https://www.elastic.co/docs/manage-data/data-store/aliases", + "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/indices-add-alias.html" + }, "operationId": "indices-put-alias-2", "parameters": [ { @@ -15098,6 +15113,11 @@ ], "summary": "Create or update an alias", "description": "Adds a data stream or index to an alias.", + "externalDocs": { + "description": "Aliases", + "url": "https://www.elastic.co/docs/manage-data/data-store/aliases", + "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/indices-add-alias.html" + }, "operationId": "indices-put-alias-3", "parameters": [ { @@ -125098,7 +125118,19 @@ }, "examples": { "indicesPutAliasRequestExample1": { - "value": "{\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n}" + "summary": "Filter an alias", + "description": "The filter option uses Query DSL to limit the documents an alias can access.", + "value": "{\n \"filter\": {\n \"bool\": {\n \"filter\": [\n {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"now-1d/d\",\n \"lt\": \"now/d\"\n }\n }\n },\n {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n ]\n }\n }\n}" + }, + "indicesPutAliasRequestExample2": { + "summary": "Write index", + "description": "You can use is_write_index to specify a write index or data stream for an alias. Elasticsearch routes any write requests for the alias to this index or data stream.", + "value": "{\n \"is_write_index\": true\n}" + }, + "indicesPutAliasRequestExample3": { + "summary": "Routing", + "description": "Use the routing option to route requests for an alias to a specific shard.", + "value": "{\n \"routing\": \"1\"\n}" } } } diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index e4e7a56f8d..005b4c93b9 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -7923,6 +7923,11 @@ ], "summary": "Create or update an alias", "description": "Adds a data stream or index to an alias.", + "externalDocs": { + "description": "Aliases", + "url": "https://www.elastic.co/docs/manage-data/data-store/aliases", + "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/indices-add-alias.html" + }, "operationId": "indices-put-alias", "parameters": [ { @@ -7960,6 +7965,11 @@ ], "summary": "Create or update an alias", "description": "Adds a data stream or index to an alias.", + "externalDocs": { + "description": "Aliases", + "url": "https://www.elastic.co/docs/manage-data/data-store/aliases", + "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/indices-add-alias.html" + }, "operationId": "indices-put-alias-1", "parameters": [ { @@ -8073,6 +8083,11 @@ ], "summary": "Create or update an alias", "description": "Adds a data stream or index to an alias.", + "externalDocs": { + "description": "Aliases", + "url": "https://www.elastic.co/docs/manage-data/data-store/aliases", + "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/indices-add-alias.html" + }, "operationId": "indices-put-alias-2", "parameters": [ { @@ -8110,6 +8125,11 @@ ], "summary": "Create or update an alias", "description": "Adds a data stream or index to an alias.", + "externalDocs": { + "description": "Aliases", + "url": "https://www.elastic.co/docs/manage-data/data-store/aliases", + "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/indices-add-alias.html" + }, "operationId": "indices-put-alias-3", "parameters": [ { @@ -74238,7 +74258,19 @@ }, "examples": { "indicesPutAliasRequestExample1": { - "value": "{\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n}" + "summary": "Filter an alias", + "description": "The filter option uses Query DSL to limit the documents an alias can access.", + "value": "{\n \"filter\": {\n \"bool\": {\n \"filter\": [\n {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"now-1d/d\",\n \"lt\": \"now/d\"\n }\n }\n },\n {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n ]\n }\n }\n}" + }, + "indicesPutAliasRequestExample2": { + "summary": "Write index", + "description": "You can use is_write_index to specify a write index or data stream for an alias. Elasticsearch routes any write requests for the alias to this index or data stream.", + "value": "{\n \"is_write_index\": true\n}" + }, + "indicesPutAliasRequestExample3": { + "summary": "Routing", + "description": "Use the routing option to route requests for an alias to a specific shard.", + "value": "{\n \"routing\": \"1\"\n}" } } } diff --git a/output/schema/schema.json b/output/schema/schema.json index a822a97cc8..637df3df9b 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -8309,7 +8309,10 @@ "description": "Create or update an alias.\nAdds a data stream or index to an alias.", "docId": "alias-update", "docUrl": "https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-put-alias", - "extPreviousVersionDocUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-add-alias.html", + "extDocDescription": "Aliases", + "extDocId": "aliases", + "extDocUrl": "https://www.elastic.co/docs/manage-data/data-store/aliases", + "extPreviousVersionDocUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/indices-add-alias.html", "name": "indices.put_alias", "request": { "name": "Request", @@ -9196,7 +9199,7 @@ "description": "Create or update an alias.\nAdds a data stream or index to an alias.", "docId": "aliases-update", "docUrl": "https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-update-aliases", - "extPreviousVersionDocUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-aliases.html", + "extPreviousVersionDocUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/indices-aliases.html", "name": "indices.update_aliases", "request": { "name": "Request", @@ -158157,8 +158160,22 @@ "language": "Java" } ], - "method_request": "POST _aliases", - "value": "{\n \"actions\": [\n {\n \"add\": {\n \"index\": \"my-data-stream\",\n \"alias\": \"my-alias\"\n }\n }\n ]\n}" + "description": "The filter option uses Query DSL to limit the documents an alias can access.", + "method_request": "POST /my-index-2099.05.06-000001/_alias/my-alias", + "summary": "Filter an alias", + "value": "{\n \"filter\": {\n \"bool\": {\n \"filter\": [\n {\n \"range\": {\n \"@timestamp\": {\n \"gte\": \"now-1d/d\",\n \"lt\": \"now/d\"\n }\n }\n },\n {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n }\n ]\n }\n }\n}" + }, + "indicesPutAliasRequestExample2": { + "description": "You can use is_write_index to specify a write index or data stream for an alias. Elasticsearch routes any write requests for the alias to this index or data stream.", + "method_request": "POST /logs-my_app-default/_alias/logs", + "summary": "Write index", + "value": "{\n \"is_write_index\": true\n}" + }, + "indicesPutAliasRequestExample3": { + "description": "Use the routing option to route requests for an alias to a specific shard.", + "method_request": "POST /my-index-2099.05.06-000001/_alias/my-alias", + "summary": "Routing", + "value": "{\n \"routing\": \"1\"\n}" } }, "inherits": { @@ -158227,7 +158244,7 @@ } } ], - "specLocation": "indices/put_alias/IndicesPutAliasRequest.ts#L25-L103" + "specLocation": "indices/put_alias/IndicesPutAliasRequest.ts#L25-L104" }, { "kind": "response", diff --git a/specification/_doc_ids/table.csv b/specification/_doc_ids/table.csv index 58022002b1..8e0e4cdc85 100644 --- a/specification/_doc_ids/table.csv +++ b/specification/_doc_ids/table.csv @@ -2,8 +2,9 @@ doc_id,doc_url,legacy_doc_url,description ack-watch,https://www.elastic.co/docs/explore-analyze/alerts-cases/watcher/actions#example,, apis,https://www.elastic.co/docs/api/doc/elasticsearch,, add-nodes,https://www.elastic.co/docs/deploy-manage/maintenance/add-and-remove-elasticsearch-nodes,, -alias-update,https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-put-alias,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-add-alias.html, -aliases-update,https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-update-aliases,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/indices-aliases.html, +alias-update,https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-put-alias,https://www.elastic.co/guide/en/elasticsearch/reference/8.19/indices-add-alias.html,Create or update an alias +aliases,https://www.elastic.co/docs/manage-data/data-store/aliases,,Aliases +aliases-update,https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-indices-update-aliases,https://www.elastic.co/guide/en/elasticsearch/reference/8.19/indices-aliases.html,Create or update aliases alibabacloud-api-keys,https://opensearch.console.aliyun.com/cn-shanghai/rag/api-key,, analysis-analyzers,https://www.elastic.co/docs/reference/text-analysis/analyzer-reference,, amazonbedrock-models,https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html,, diff --git a/specification/indices/put_alias/IndicesPutAliasRequest.ts b/specification/indices/put_alias/IndicesPutAliasRequest.ts index ffd0593739..2daff3d7cb 100644 --- a/specification/indices/put_alias/IndicesPutAliasRequest.ts +++ b/specification/indices/put_alias/IndicesPutAliasRequest.ts @@ -29,6 +29,7 @@ import { Duration } from '@_types/Time' * @availability stack stability=stable * @availability serverless stability=stable visibility=public * @doc_id alias-update + * @ext_doc_id aliases */ export interface Request extends RequestBase { urls: [ diff --git a/specification/indices/put_alias/examples/request/indicesPutAliasRequestExample1.yaml b/specification/indices/put_alias/examples/request/indicesPutAliasRequestExample1.yaml index 0fb6621d7c..e91356509f 100644 --- a/specification/indices/put_alias/examples/request/indicesPutAliasRequestExample1.yaml +++ b/specification/indices/put_alias/examples/request/indicesPutAliasRequestExample1.yaml @@ -1,23 +1,26 @@ -# summary: indices/aliases.asciidoc:10 -method_request: POST _aliases -# description: '' +summary: Filter an alias +method_request: POST /my-index-2099.05.06-000001/_alias/my-alias +description: The filter option uses Query DSL to limit the documents an alias can access. # type: request -value: "{ - - \ \"actions\": [ - - \ { - - \ \"add\": { - - \ \"index\": \"my-data-stream\", - - \ \"alias\": \"my-alias\" - - \ } - - \ } - - \ ] - - }" +value: |- + { + "filter": { + "bool": { + "filter": [ + { + "range": { + "@timestamp": { + "gte": "now-1d/d", + "lt": "now/d" + } + } + }, + { + "term": { + "user.id": "kimchy" + } + } + ] + } + } + } diff --git a/specification/indices/put_alias/examples/request/indicesPutAliasRequestExample2.yaml b/specification/indices/put_alias/examples/request/indicesPutAliasRequestExample2.yaml new file mode 100644 index 0000000000..3325f25f1e --- /dev/null +++ b/specification/indices/put_alias/examples/request/indicesPutAliasRequestExample2.yaml @@ -0,0 +1,10 @@ +summary: Write index +method_request: POST /logs-my_app-default/_alias/logs +description: + You can use is_write_index to specify a write index or data stream for an alias. Elasticsearch routes any write + requests for the alias to this index or data stream. +# type: request +value: |- + { + "is_write_index": true + } diff --git a/specification/indices/put_alias/examples/request/indicesPutAliasRequestExample3.yaml b/specification/indices/put_alias/examples/request/indicesPutAliasRequestExample3.yaml new file mode 100644 index 0000000000..feb3b68657 --- /dev/null +++ b/specification/indices/put_alias/examples/request/indicesPutAliasRequestExample3.yaml @@ -0,0 +1,8 @@ +summary: Routing +method_request: POST /my-index-2099.05.06-000001/_alias/my-alias +description: Use the routing option to route requests for an alias to a specific shard. +# type: request +value: |- + { + "routing": "1" + }