From 686c48327037af2e6981cb0949660ef1f3d7c3e5 Mon Sep 17 00:00:00 2001 From: Niels Bauman Date: Wed, 25 Jun 2025 11:41:00 -0300 Subject: [PATCH 1/9] Add index block removal API Follow-up of https://github.com/elastic/elasticsearch/pull/129128 --- .../add_block/IndicesAddBlockRequest.ts | 14 +-- .../remove_block/IndicesRemoveBlockRequest.ts | 90 +++++++++++++++++++ .../IndicesRemoveBlockResponse.ts | 32 +++++++ .../IndicesRemoveBlockRequestExample1.yaml | 34 +++++++ .../IndicesAddBlockResponseExample1.yaml | 12 +++ 5 files changed, 170 insertions(+), 12 deletions(-) create mode 100644 specification/indices/remove_block/IndicesRemoveBlockRequest.ts create mode 100644 specification/indices/remove_block/IndicesRemoveBlockResponse.ts create mode 100644 specification/indices/remove_block/examples/request/IndicesRemoveBlockRequestExample1.yaml create mode 100644 specification/indices/remove_block/examples/response/IndicesAddBlockResponseExample1.yaml diff --git a/specification/indices/add_block/IndicesAddBlockRequest.ts b/specification/indices/add_block/IndicesAddBlockRequest.ts index 4e553ccb3e..980d2f4113 100644 --- a/specification/indices/add_block/IndicesAddBlockRequest.ts +++ b/specification/indices/add_block/IndicesAddBlockRequest.ts @@ -20,6 +20,7 @@ import { RequestBase } from '@_types/Base' import { ExpandWildcards, IndexName } from '@_types/common' import { Duration } from '@_types/Time' +import {IndexSettingBlocks, IndexSettings} from "../_types/IndexSettings"; /** * Add an index block. @@ -49,7 +50,7 @@ export interface Request extends RequestBase { /** * The block type to add to the index. */ - block: IndicesBlockOptions + block: keyof IndexSettingBlocks } query_parameters: { /** @@ -87,14 +88,3 @@ export interface Request extends RequestBase { timeout?: Duration // default: 30s } } - -export enum IndicesBlockOptions { - /** Disable metadata changes, such as closing the index. */ - metadata, - /** Disable read operations. */ - read, - /** Disable write operations and metadata changes. */ - read_only, - /** Disable write operations. However, metadata changes are still allowed. */ - write -} diff --git a/specification/indices/remove_block/IndicesRemoveBlockRequest.ts b/specification/indices/remove_block/IndicesRemoveBlockRequest.ts new file mode 100644 index 0000000000..e722037759 --- /dev/null +++ b/specification/indices/remove_block/IndicesRemoveBlockRequest.ts @@ -0,0 +1,90 @@ +/* + * 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' +import { ExpandWildcards, IndexName } from '@_types/common' +import { Duration } from '@_types/Time' +import {IndexSettingBlocks, IndexSettings} from "../_types/IndexSettings"; + +/** + * Remove an index block. + * + * Remove an index block from an index. + * Index blocks limit the operations allowed on an index by blocking specific operation types. + * @rest_spec_name indices.remove_block + * @availability stack since=9.1.0 stability=stable + * @availability serverless stability=stable visibility=public + * @doc_id index-block-remove + */ +export interface Request extends RequestBase { + urls: [ + { + path: '/{index}/_block/{block}' + methods: ['DELETE'] + } + ] + path_parts: { + /** + * A comma-separated list or wildcard expression of index names used to limit the request. + * By default, you must explicitly name the indices you are removing blocks from. + * To allow the removal of blocks from indices with `_all`, `*`, or other wildcard expressions, change the `action.destructive_requires_name` setting to `false`. + * You can update this setting in the `elasticsearch.yml` file or by using the cluster update settings API. + */ + index: IndexName + /** + * The block type to remove from the index. + */ + block: keyof IndexSettingBlocks + } + query_parameters: { + /** + * If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. + * This behavior applies even if the request targets other open indices. + * For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. + * @server_default true + */ + allow_no_indices?: boolean // default: true + /** + * The type of index that wildcard patterns can match. + * If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. + * It supports comma-separated values, such as `open,hidden`. + * @server_default open + */ + expand_wildcards?: ExpandWildcards // default: open + /** + * If `false`, the request returns an error if it targets a missing or closed index. + * @server_default false + */ + ignore_unavailable?: boolean // default: false + /** + * The period to wait for the master node. + * If the master node is not available before the timeout expires, the request fails and returns an error. + * It can also be set to `-1` to indicate that the request should never timeout. + * @server_default 30s + */ + master_timeout?: Duration // default: 30s + /** + * The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. + * If no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged. + * It can also be set to `-1` to indicate that the request should never timeout. + * @server_default 30s + */ + timeout?: Duration // default: 30s + } +} diff --git a/specification/indices/remove_block/IndicesRemoveBlockResponse.ts b/specification/indices/remove_block/IndicesRemoveBlockResponse.ts new file mode 100644 index 0000000000..d8d63beab3 --- /dev/null +++ b/specification/indices/remove_block/IndicesRemoveBlockResponse.ts @@ -0,0 +1,32 @@ +/* + * 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 { IndexName } from '@_types/common' + +export class Response { + body: { + acknowledged: boolean + indices: IndicesBlockStatus[] + } +} + +export class IndicesBlockStatus { + name: IndexName + unblocked: boolean +} diff --git a/specification/indices/remove_block/examples/request/IndicesRemoveBlockRequestExample1.yaml b/specification/indices/remove_block/examples/request/IndicesRemoveBlockRequestExample1.yaml new file mode 100644 index 0000000000..d68070eadd --- /dev/null +++ b/specification/indices/remove_block/examples/request/IndicesRemoveBlockRequestExample1.yaml @@ -0,0 +1,34 @@ +method_request: DELETE /my-index-000001/_block/write +alternatives: + - language: Python + code: |- + resp = client.indices.remove_block( + index="my-index-000001", + block="write", + ) + - language: JavaScript + code: |- + const response = await client.indices.removeBlock({ + index: "my-index-000001", + block: "write", + }); + - language: Ruby + code: |- + response = client.indices.remove_block( + index: "my-index-000001", + block: "write" + ) + - language: PHP + code: |- + $resp = $client->indices()->removeBlock([ + "index" => "my-index-000001", + "block" => "write", + ]); + - language: curl + code: 'curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/my-index-000001/_block/write"' + - language: Java + code: | + client.indices().removeBlock(a -> a + .block(IndicesBlockOptions.Write) + .index("my-index-000001") + ); diff --git a/specification/indices/remove_block/examples/response/IndicesAddBlockResponseExample1.yaml b/specification/indices/remove_block/examples/response/IndicesAddBlockResponseExample1.yaml new file mode 100644 index 0000000000..ddedd83f48 --- /dev/null +++ b/specification/indices/remove_block/examples/response/IndicesAddBlockResponseExample1.yaml @@ -0,0 +1,12 @@ +# summary: '' +description: A successful response from `DELETE /my-index-000001/_block/write`, which removes an index block from an index.' +# type: response +# response_code: 200 +value: |- + { + "acknowledged" : true, + "indices" : [ { + "name" : "my-index-000001", + "unblocked" : true + } ] + } From 47f4e218fccf2fecfa8ebde72b8519c300f42900 Mon Sep 17 00:00:00 2001 From: Niels Bauman Date: Thu, 26 Jun 2025 15:15:51 -0300 Subject: [PATCH 2/9] Fix block enum --- .../indices/add_block/IndicesAddBlockRequest.ts | 14 ++++++++++++-- .../remove_block/IndicesRemoveBlockRequest.ts | 13 ++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/specification/indices/add_block/IndicesAddBlockRequest.ts b/specification/indices/add_block/IndicesAddBlockRequest.ts index 980d2f4113..4e553ccb3e 100644 --- a/specification/indices/add_block/IndicesAddBlockRequest.ts +++ b/specification/indices/add_block/IndicesAddBlockRequest.ts @@ -20,7 +20,6 @@ import { RequestBase } from '@_types/Base' import { ExpandWildcards, IndexName } from '@_types/common' import { Duration } from '@_types/Time' -import {IndexSettingBlocks, IndexSettings} from "../_types/IndexSettings"; /** * Add an index block. @@ -50,7 +49,7 @@ export interface Request extends RequestBase { /** * The block type to add to the index. */ - block: keyof IndexSettingBlocks + block: IndicesBlockOptions } query_parameters: { /** @@ -88,3 +87,14 @@ export interface Request extends RequestBase { timeout?: Duration // default: 30s } } + +export enum IndicesBlockOptions { + /** Disable metadata changes, such as closing the index. */ + metadata, + /** Disable read operations. */ + read, + /** Disable write operations and metadata changes. */ + read_only, + /** Disable write operations. However, metadata changes are still allowed. */ + write +} diff --git a/specification/indices/remove_block/IndicesRemoveBlockRequest.ts b/specification/indices/remove_block/IndicesRemoveBlockRequest.ts index e722037759..ffc98e65b8 100644 --- a/specification/indices/remove_block/IndicesRemoveBlockRequest.ts +++ b/specification/indices/remove_block/IndicesRemoveBlockRequest.ts @@ -50,7 +50,7 @@ export interface Request extends RequestBase { /** * The block type to remove from the index. */ - block: keyof IndexSettingBlocks + block: IndicesBlockOptions } query_parameters: { /** @@ -88,3 +88,14 @@ export interface Request extends RequestBase { timeout?: Duration // default: 30s } } + +export enum IndicesBlockOptions { + /** Disable metadata changes, such as closing the index. */ + metadata, + /** Disable read operations. */ + read, + /** Disable write operations and metadata changes. */ + read_only, + /** Disable write operations. However, metadata changes are still allowed. */ + write +} From e4941f11f40f0137fc3895f2e7f501ebb1d9e48f Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 27 Jun 2025 14:26:34 +0400 Subject: [PATCH 3/9] Add doc-id to table --- specification/_doc_ids/table.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/specification/_doc_ids/table.csv b/specification/_doc_ids/table.csv index 6a0a214e4f..9e900d020e 100644 --- a/specification/_doc_ids/table.csv +++ b/specification/_doc_ids/table.csv @@ -283,6 +283,7 @@ ilm-start,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation- ilm-stop,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ilm-stop,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ilm-stop.html important-settings,https://www.elastic.co/docs/deploy-manage/deploy/self-managed/important-settings-configuration, index-block-add,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-add-block, +index-block-remove,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-remove-block, index-modules-blocks,https://www.elastic.co/docs/reference/elasticsearch/index-settings/index-block, index-modules-settings,https://www.elastic.co/docs/reference/elasticsearch/index-settings/index-modules, index-modules-slowlog-slowlog,https://www.elastic.co/docs/reference/elasticsearch/index-settings/slow-log#index-slow-log, From 7c4551ae3de49c5f909a8894525b83e66587a851 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 27 Jun 2025 14:28:16 +0400 Subject: [PATCH 4/9] Fix lint --- specification/indices/remove_block/IndicesRemoveBlockRequest.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/specification/indices/remove_block/IndicesRemoveBlockRequest.ts b/specification/indices/remove_block/IndicesRemoveBlockRequest.ts index ffc98e65b8..08586e8736 100644 --- a/specification/indices/remove_block/IndicesRemoveBlockRequest.ts +++ b/specification/indices/remove_block/IndicesRemoveBlockRequest.ts @@ -20,7 +20,6 @@ import { RequestBase } from '@_types/Base' import { ExpandWildcards, IndexName } from '@_types/common' import { Duration } from '@_types/Time' -import {IndexSettingBlocks, IndexSettings} from "../_types/IndexSettings"; /** * Remove an index block. From fff96428866b02eef98f2e62585405772959f396 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 27 Jun 2025 16:11:42 +0400 Subject: [PATCH 5/9] Move IndicesBlockOptions and IndicesBlockStatus to indices/_types It's breaking but avoids duplicating the type names, which is forbidden. --- output/openapi/elasticsearch-openapi.json | 125 ++++- .../elasticsearch-serverless-openapi.json | 125 ++++- output/schema/schema.json | 430 +++++++++++++----- output/typescript/types.ts | 33 +- specification/indices/_types/IndexSettings.ts | 17 + .../add_block/IndicesAddBlockRequest.ts | 12 +- .../add_block/IndicesAddBlockResponse.ts | 7 +- .../remove_block/IndicesRemoveBlockRequest.ts | 12 +- .../IndicesRemoveBlockResponse.ts | 7 +- 9 files changed, 602 insertions(+), 166 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 94f6650765..bf932c3e5b 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -12663,7 +12663,7 @@ "required": true, "deprecated": false, "schema": { - "$ref": "#/components/schemas/indices.add_block.IndicesBlockOptions" + "$ref": "#/components/schemas/indices._types.IndicesBlockOptions" }, "style": "simple" }, @@ -12735,7 +12735,7 @@ "indices": { "type": "array", "items": { - "$ref": "#/components/schemas/indices.add_block.IndicesBlockStatus" + "$ref": "#/components/schemas/indices._types.IndicesBlockStatus" } } }, @@ -12757,6 +12757,123 @@ }, "x-state": "Generally available; Added in 7.9.0", "x-product-feature": "elasticsearch" + }, + "delete": { + "tags": [ + "indices" + ], + "summary": "Remove an index block", + "description": "Remove an index block from an index.\nIndex blocks limit the operations allowed on an index by blocking specific operation types.", + "operationId": "indices-remove-block", + "parameters": [ + { + "in": "path", + "name": "index", + "description": "A comma-separated list or wildcard expression of index names used to limit the request.\nBy default, you must explicitly name the indices you are removing blocks from.\nTo allow the removal of blocks from indices with `_all`, `*`, or other wildcard expressions, change the `action.destructive_requires_name` setting to `false`.\nYou can update this setting in the `elasticsearch.yml` file or by using the cluster update settings API.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.IndexName" + }, + "style": "simple" + }, + { + "in": "path", + "name": "block", + "description": "The block type to remove from the index.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/indices._types.IndicesBlockOptions" + }, + "style": "simple" + }, + { + "in": "query", + "name": "allow_no_indices", + "description": "If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices.\nThis behavior applies even if the request targets other open indices.\nFor example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`.", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" + }, + { + "in": "query", + "name": "expand_wildcards", + "description": "The type of index that wildcard patterns can match.\nIf the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.\nIt supports comma-separated values, such as `open,hidden`.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.ExpandWildcards" + }, + "style": "form" + }, + { + "in": "query", + "name": "ignore_unavailable", + "description": "If `false`, the request returns an error if it targets a missing or closed index.", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" + }, + { + "in": "query", + "name": "master_timeout", + "description": "The period to wait for the master node.\nIf the master node is not available before the timeout expires, the request fails and returns an error.\nIt can also be set to `-1` to indicate that the request should never timeout.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Duration" + }, + "style": "form" + }, + { + "in": "query", + "name": "timeout", + "description": "The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata.\nIf no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged.\nIt can also be set to `-1` to indicate that the request should never timeout.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Duration" + }, + "style": "form" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "acknowledged": { + "type": "boolean" + }, + "indices": { + "type": "array", + "items": { + "$ref": "#/components/schemas/indices._types.IndicesBlockStatus" + } + } + }, + "required": [ + "acknowledged", + "indices" + ] + }, + "examples": { + "IndicesAddBlockResponseExample1": { + "description": "A successful response from `DELETE /my-index-000001/_block/write`, which removes an index block from an index.'", + "value": "{\n \"acknowledged\" : true,\n \"indices\" : [ {\n \"name\" : \"my-index-000001\",\n \"unblocked\" : true\n } ]\n}" + } + } + } + } + } + }, + "x-state": "Generally available; Added in 9.1.0", + "x-product-feature": "elasticsearch" } }, "/_analyze": { @@ -78890,7 +79007,7 @@ "phase" ] }, - "indices.add_block.IndicesBlockOptions": { + "indices._types.IndicesBlockOptions": { "type": "string", "enum": [ "metadata", @@ -78899,7 +79016,7 @@ "write" ] }, - "indices.add_block.IndicesBlockStatus": { + "indices._types.IndicesBlockStatus": { "type": "object", "properties": { "name": { diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index c60a78aa44..d2265d271b 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -6628,7 +6628,7 @@ "required": true, "deprecated": false, "schema": { - "$ref": "#/components/schemas/indices.add_block.IndicesBlockOptions" + "$ref": "#/components/schemas/indices._types.IndicesBlockOptions" }, "style": "simple" }, @@ -6700,7 +6700,7 @@ "indices": { "type": "array", "items": { - "$ref": "#/components/schemas/indices.add_block.IndicesBlockStatus" + "$ref": "#/components/schemas/indices._types.IndicesBlockStatus" } } }, @@ -6722,6 +6722,123 @@ }, "x-state": "Generally available", "x-product-feature": "elasticsearch" + }, + "delete": { + "tags": [ + "indices" + ], + "summary": "Remove an index block", + "description": "Remove an index block from an index.\nIndex blocks limit the operations allowed on an index by blocking specific operation types.", + "operationId": "indices-remove-block", + "parameters": [ + { + "in": "path", + "name": "index", + "description": "A comma-separated list or wildcard expression of index names used to limit the request.\nBy default, you must explicitly name the indices you are removing blocks from.\nTo allow the removal of blocks from indices with `_all`, `*`, or other wildcard expressions, change the `action.destructive_requires_name` setting to `false`.\nYou can update this setting in the `elasticsearch.yml` file or by using the cluster update settings API.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.IndexName" + }, + "style": "simple" + }, + { + "in": "path", + "name": "block", + "description": "The block type to remove from the index.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/indices._types.IndicesBlockOptions" + }, + "style": "simple" + }, + { + "in": "query", + "name": "allow_no_indices", + "description": "If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices.\nThis behavior applies even if the request targets other open indices.\nFor example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`.", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" + }, + { + "in": "query", + "name": "expand_wildcards", + "description": "The type of index that wildcard patterns can match.\nIf the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.\nIt supports comma-separated values, such as `open,hidden`.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.ExpandWildcards" + }, + "style": "form" + }, + { + "in": "query", + "name": "ignore_unavailable", + "description": "If `false`, the request returns an error if it targets a missing or closed index.", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" + }, + { + "in": "query", + "name": "master_timeout", + "description": "The period to wait for the master node.\nIf the master node is not available before the timeout expires, the request fails and returns an error.\nIt can also be set to `-1` to indicate that the request should never timeout.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Duration" + }, + "style": "form" + }, + { + "in": "query", + "name": "timeout", + "description": "The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata.\nIf no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged.\nIt can also be set to `-1` to indicate that the request should never timeout.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Duration" + }, + "style": "form" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "acknowledged": { + "type": "boolean" + }, + "indices": { + "type": "array", + "items": { + "$ref": "#/components/schemas/indices._types.IndicesBlockStatus" + } + } + }, + "required": [ + "acknowledged", + "indices" + ] + }, + "examples": { + "IndicesAddBlockResponseExample1": { + "description": "A successful response from `DELETE /my-index-000001/_block/write`, which removes an index block from an index.'", + "value": "{\n \"acknowledged\" : true,\n \"indices\" : [ {\n \"name\" : \"my-index-000001\",\n \"unblocked\" : true\n } ]\n}" + } + } + } + } + } + }, + "x-state": "Generally available", + "x-product-feature": "elasticsearch" } }, "/_analyze": { @@ -50913,7 +51030,7 @@ "weight" ] }, - "indices.add_block.IndicesBlockOptions": { + "indices._types.IndicesBlockOptions": { "type": "string", "enum": [ "metadata", @@ -50922,7 +51039,7 @@ "write" ] }, - "indices.add_block.IndicesBlockStatus": { + "indices._types.IndicesBlockStatus": { "type": "object", "properties": { "name": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 87cac66916..343f06ebb5 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -8995,17 +8995,28 @@ }, { "availability": { - "stack": { + "serverless": { "stability": "stable", "visibility": "public" + }, + "stack": { + "since": "9.1.0", + "stability": "stable" } }, - "description": "Removes a block from an index.", - "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/master/index-modules-blocks.html", + "description": "Remove an index block.\n\nRemove an index block from an index.\nIndex blocks limit the operations allowed on an index by blocking specific operation types.", + "docId": "index-block-remove", + "docUrl": "https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-remove-block", "name": "indices.remove_block", - "request": null, + "request": { + "name": "Request", + "namespace": "indices.remove_block" + }, "requestBodyRequired": false, - "response": null, + "response": { + "name": "Response", + "namespace": "indices.remove_block" + }, "responseMediaType": [ "application/json" ], @@ -140865,7 +140876,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L423-L425" + "specLocation": "indices/_types/IndexSettings.ts#L440-L442" }, { "kind": "interface", @@ -141883,7 +141894,7 @@ "name": "IndexCheckOnStartup", "namespace": "indices._types" }, - "specLocation": "indices/_types/IndexSettings.ts#L272-L279" + "specLocation": "indices/_types/IndexSettings.ts#L289-L296" }, { "kind": "enum", @@ -142351,7 +142362,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L264-L270" + "specLocation": "indices/_types/IndexSettings.ts#L265-L271" }, { "kind": "interface", @@ -143176,7 +143187,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L70-L178" + "specLocation": "indices/_types/IndexSettings.ts#L71-L179" }, { "kind": "interface", @@ -143296,7 +143307,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L335-L341" + "specLocation": "indices/_types/IndexSettings.ts#L352-L358" }, { "kind": "interface", @@ -143414,7 +143425,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L286-L325" + "specLocation": "indices/_types/IndexSettings.ts#L303-L342" }, { "kind": "interface", @@ -143436,7 +143447,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L327-L333" + "specLocation": "indices/_types/IndexSettings.ts#L344-L350" }, { "kind": "interface", @@ -143468,7 +143479,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L343-L346" + "specLocation": "indices/_types/IndexSettings.ts#L360-L363" }, { "kind": "interface", @@ -143889,7 +143900,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L281-L284" + "specLocation": "indices/_types/IndexSettings.ts#L298-L301" }, { "kind": "interface", @@ -143910,7 +143921,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L577-L579" + "specLocation": "indices/_types/IndexSettings.ts#L594-L596" }, { "kind": "interface", @@ -143932,7 +143943,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L581-L588" + "specLocation": "indices/_types/IndexSettings.ts#L598-L605" }, { "kind": "interface", @@ -143986,7 +143997,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L590-L595" + "specLocation": "indices/_types/IndexSettings.ts#L607-L612" }, { "kind": "interface", @@ -144010,7 +144021,65 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L597-L604" + "specLocation": "indices/_types/IndexSettings.ts#L614-L621" + }, + { + "kind": "enum", + "members": [ + { + "description": "Disable metadata changes, such as closing the index.", + "name": "metadata" + }, + { + "description": "Disable read operations.", + "name": "read" + }, + { + "description": "Disable write operations and metadata changes.", + "name": "read_only" + }, + { + "description": "Disable write operations. However, metadata changes are still allowed.", + "name": "write" + } + ], + "name": { + "name": "IndicesBlockOptions", + "namespace": "indices._types" + }, + "specLocation": "indices/_types/IndexSettings.ts#L273-L282" + }, + { + "kind": "interface", + "name": { + "name": "IndicesBlockStatus", + "namespace": "indices._types" + }, + "properties": [ + { + "name": "name", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "IndexName", + "namespace": "_types" + } + } + }, + { + "name": "blocked", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "indices/_types/IndexSettings.ts#L284-L287" }, { "kind": "enum", @@ -144156,7 +144225,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L427-L441" + "specLocation": "indices/_types/IndexSettings.ts#L444-L458" }, { "kind": "interface", @@ -144179,7 +144248,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L462-L469" + "specLocation": "indices/_types/IndexSettings.ts#L479-L486" }, { "kind": "interface", @@ -144201,7 +144270,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L499-L505" + "specLocation": "indices/_types/IndexSettings.ts#L516-L522" }, { "kind": "interface", @@ -144223,7 +144292,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L490-L497" + "specLocation": "indices/_types/IndexSettings.ts#L507-L514" }, { "kind": "interface", @@ -144246,7 +144315,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L471-L479" + "specLocation": "indices/_types/IndexSettings.ts#L488-L496" }, { "kind": "interface", @@ -144269,7 +144338,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L481-L488" + "specLocation": "indices/_types/IndexSettings.ts#L498-L505" }, { "kind": "interface", @@ -144290,7 +144359,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L507-L509" + "specLocation": "indices/_types/IndexSettings.ts#L524-L526" }, { "kind": "interface", @@ -144350,7 +144419,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L443-L460" + "specLocation": "indices/_types/IndexSettings.ts#L460-L477" }, { "kind": "interface", @@ -144371,7 +144440,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L348-L350" + "specLocation": "indices/_types/IndexSettings.ts#L365-L367" }, { "kind": "interface", @@ -144421,7 +144490,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L352-L355" + "specLocation": "indices/_types/IndexSettings.ts#L369-L372" }, { "kind": "interface", @@ -144479,7 +144548,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L419-L421" + "specLocation": "indices/_types/IndexSettings.ts#L436-L438" }, { "kind": "interface", @@ -144500,7 +144569,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L66-L68" + "specLocation": "indices/_types/IndexSettings.ts#L67-L69" }, { "kind": "interface", @@ -144522,7 +144591,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L255-L258" + "specLocation": "indices/_types/IndexSettings.ts#L256-L259" }, { "kind": "enum", @@ -144615,7 +144684,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L245-L248" + "specLocation": "indices/_types/IndexSettings.ts#L246-L249" }, { "kind": "interface", @@ -144637,7 +144706,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L240-L243" + "specLocation": "indices/_types/IndexSettings.ts#L241-L244" }, { "kind": "interface", @@ -144667,7 +144736,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L260-L262" + "specLocation": "indices/_types/IndexSettings.ts#L261-L263" }, { "kind": "interface", @@ -144699,7 +144768,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L250-L253" + "specLocation": "indices/_types/IndexSettings.ts#L251-L254" }, { "kind": "type_alias", @@ -144707,7 +144776,7 @@ "name": "SettingsSimilarity", "namespace": "indices._types" }, - "specLocation": "indices/_types/IndexSettings.ts#L180-L192", + "specLocation": "indices/_types/IndexSettings.ts#L181-L193", "type": { "kind": "union_of", "items": [ @@ -144824,7 +144893,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L198-L203" + "specLocation": "indices/_types/IndexSettings.ts#L199-L204" }, { "kind": "interface", @@ -144842,7 +144911,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L194-L196" + "specLocation": "indices/_types/IndexSettings.ts#L195-L197" }, { "kind": "interface", @@ -144871,7 +144940,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L205-L208" + "specLocation": "indices/_types/IndexSettings.ts#L206-L209" }, { "kind": "interface", @@ -144922,7 +144991,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L210-L215" + "specLocation": "indices/_types/IndexSettings.ts#L211-L216" }, { "kind": "interface", @@ -144973,7 +145042,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L217-L222" + "specLocation": "indices/_types/IndexSettings.ts#L218-L223" }, { "kind": "interface", @@ -145002,7 +145071,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L224-L227" + "specLocation": "indices/_types/IndexSettings.ts#L225-L228" }, { "kind": "interface", @@ -145031,7 +145100,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L229-L232" + "specLocation": "indices/_types/IndexSettings.ts#L230-L233" }, { "kind": "interface", @@ -145071,7 +145140,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L234-L238" + "specLocation": "indices/_types/IndexSettings.ts#L235-L239" }, { "kind": "interface", @@ -145125,7 +145194,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L517-L522" + "specLocation": "indices/_types/IndexSettings.ts#L534-L539" }, { "kind": "interface", @@ -145179,7 +145248,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L529-L534" + "specLocation": "indices/_types/IndexSettings.ts#L546-L551" }, { "kind": "interface", @@ -145211,7 +145280,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L524-L527" + "specLocation": "indices/_types/IndexSettings.ts#L541-L544" }, { "kind": "interface", @@ -145246,7 +145315,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L51-L64" + "specLocation": "indices/_types/IndexSettings.ts#L52-L65" }, { "kind": "enum", @@ -145265,7 +145334,7 @@ "name": "SourceMode", "namespace": "indices._types" }, - "specLocation": "indices/_types/IndexSettings.ts#L511-L515" + "specLocation": "indices/_types/IndexSettings.ts#L528-L532" }, { "kind": "interface", @@ -145298,7 +145367,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L536-L545" + "specLocation": "indices/_types/IndexSettings.ts#L553-L562" }, { "kind": "enum", @@ -145325,7 +145394,7 @@ "name": "StorageType", "namespace": "indices._types" }, - "specLocation": "indices/_types/IndexSettings.ts#L547-L575" + "specLocation": "indices/_types/IndexSettings.ts#L564-L592" }, { "kind": "interface", @@ -145482,7 +145551,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L357-L379" + "specLocation": "indices/_types/IndexSettings.ts#L374-L396" }, { "kind": "enum", @@ -145506,7 +145575,7 @@ "name": "TranslogDurability", "namespace": "indices._types" }, - "specLocation": "indices/_types/IndexSettings.ts#L381-L396" + "specLocation": "indices/_types/IndexSettings.ts#L398-L413" }, { "kind": "interface", @@ -145542,65 +145611,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L398-L417" - }, - { - "kind": "enum", - "members": [ - { - "description": "Disable metadata changes, such as closing the index.", - "name": "metadata" - }, - { - "description": "Disable read operations.", - "name": "read" - }, - { - "description": "Disable write operations and metadata changes.", - "name": "read_only" - }, - { - "description": "Disable write operations. However, metadata changes are still allowed.", - "name": "write" - } - ], - "name": { - "name": "IndicesBlockOptions", - "namespace": "indices.add_block" - }, - "specLocation": "indices/add_block/IndicesAddBlockRequest.ts#L91-L100" - }, - { - "kind": "interface", - "name": { - "name": "IndicesBlockStatus", - "namespace": "indices.add_block" - }, - "properties": [ - { - "name": "name", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "IndexName", - "namespace": "_types" - } - } - }, - { - "name": "blocked", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "boolean", - "namespace": "_builtins" - } - } - } - ], - "specLocation": "indices/add_block/IndicesAddBlockResponse.ts#L30-L33" + "specLocation": "indices/_types/IndexSettings.ts#L415-L434" }, { "kind": "request", @@ -145673,7 +145684,7 @@ "kind": "instance_of", "type": { "name": "IndicesBlockOptions", - "namespace": "indices.add_block" + "namespace": "indices._types" } } } @@ -145745,7 +145756,7 @@ } } ], - "specLocation": "indices/add_block/IndicesAddBlockRequest.ts#L24-L89" + "specLocation": "indices/add_block/IndicesAddBlockRequest.ts#L25-L90" }, { "kind": "response", @@ -145783,7 +145794,7 @@ "kind": "instance_of", "type": { "name": "IndicesBlockStatus", - "namespace": "indices.add_block" + "namespace": "indices._types" } } } @@ -157750,6 +157761,195 @@ }, "specLocation": "indices/reload_search_analyzers/ReloadSearchAnalyzersResponse.ts#L22-L25" }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "no_body" + }, + "description": "Remove an index block.\n\nRemove an index block from an index.\nIndex blocks limit the operations allowed on an index by blocking specific operation types.", + "examples": { + "IndicesRemoveBlockRequestExample1": { + "alternatives": [ + { + "code": "resp = client.indices.remove_block(\n index=\"my-index-000001\",\n block=\"write\",\n)", + "language": "Python" + }, + { + "code": "const response = await client.indices.removeBlock({\n index: \"my-index-000001\",\n block: \"write\",\n});", + "language": "JavaScript" + }, + { + "code": "response = client.indices.remove_block(\n index: \"my-index-000001\",\n block: \"write\"\n)", + "language": "Ruby" + }, + { + "code": "$resp = $client->indices()->removeBlock([\n \"index\" => \"my-index-000001\",\n \"block\" => \"write\",\n]);", + "language": "PHP" + }, + { + "code": "curl -X DELETE -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_block/write\"", + "language": "curl" + }, + { + "code": "client.indices().removeBlock(a -> a\n .block(IndicesBlockOptions.Write)\n .index(\"my-index-000001\")\n);\n", + "language": "Java" + } + ], + "method_request": "DELETE /my-index-000001/_block/write" + } + }, + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "indices.remove_block" + }, + "path": [ + { + "description": "A comma-separated list or wildcard expression of index names used to limit the request.\nBy default, you must explicitly name the indices you are removing blocks from.\nTo allow the removal of blocks from indices with `_all`, `*`, or other wildcard expressions, change the `action.destructive_requires_name` setting to `false`.\nYou can update this setting in the `elasticsearch.yml` file or by using the cluster update settings API.", + "name": "index", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "IndexName", + "namespace": "_types" + } + } + }, + { + "description": "The block type to remove from the index.", + "name": "block", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "IndicesBlockOptions", + "namespace": "indices._types" + } + } + } + ], + "query": [ + { + "description": "If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices.\nThis behavior applies even if the request targets other open indices.\nFor example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`.", + "name": "allow_no_indices", + "required": false, + "serverDefault": true, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "The type of index that wildcard patterns can match.\nIf the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.\nIt supports comma-separated values, such as `open,hidden`.", + "name": "expand_wildcards", + "required": false, + "serverDefault": "open", + "type": { + "kind": "instance_of", + "type": { + "name": "ExpandWildcards", + "namespace": "_types" + } + } + }, + { + "description": "If `false`, the request returns an error if it targets a missing or closed index.", + "name": "ignore_unavailable", + "required": false, + "serverDefault": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "The period to wait for the master node.\nIf the master node is not available before the timeout expires, the request fails and returns an error.\nIt can also be set to `-1` to indicate that the request should never timeout.", + "name": "master_timeout", + "required": false, + "serverDefault": "30s", + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + }, + { + "description": "The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata.\nIf no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged.\nIt can also be set to `-1` to indicate that the request should never timeout.", + "name": "timeout", + "required": false, + "serverDefault": "30s", + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + } + ], + "specLocation": "indices/remove_block/IndicesRemoveBlockRequest.ts#L25-L90" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [ + { + "name": "acknowledged", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "indices", + "required": true, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "IndicesBlockStatus", + "namespace": "indices._types" + } + } + } + } + ] + }, + "examples": { + "IndicesAddBlockResponseExample1": { + "description": "A successful response from `DELETE /my-index-000001/_block/write`, which removes an index block from an index.'", + "value": "{\n \"acknowledged\" : true,\n \"indices\" : [ {\n \"name\" : \"my-index-000001\",\n \"unblocked\" : true\n } ]\n}" + } + }, + "name": { + "name": "Response", + "namespace": "indices.remove_block" + }, + "specLocation": "indices/remove_block/IndicesRemoveBlockResponse.ts#L22-L27" + }, { "kind": "request", "attachedBehaviors": [ diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 8802ff3e24..adbcab58de 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -11749,6 +11749,13 @@ export interface IndicesIndexingSlowlogTresholds { index?: IndicesSlowlogTresholdLevels } +export type IndicesIndicesBlockOptions = 'metadata' | 'read' | 'read_only' | 'write' + +export interface IndicesIndicesBlockStatus { + name: IndexName + blocked: boolean +} + export type IndicesManagedBy = 'Index Lifecycle Management' | 'Data stream lifecycle' | 'Unmanaged' export interface IndicesMappingLimitSettings { @@ -11946,16 +11953,9 @@ export interface IndicesTranslogRetention { age?: Duration } -export type IndicesAddBlockIndicesBlockOptions = 'metadata' | 'read' | 'read_only' | 'write' - -export interface IndicesAddBlockIndicesBlockStatus { - name: IndexName - blocked: boolean -} - export interface IndicesAddBlockRequest extends RequestBase { index: IndexName - block: IndicesAddBlockIndicesBlockOptions + block: IndicesIndicesBlockOptions allow_no_indices?: boolean expand_wildcards?: ExpandWildcards ignore_unavailable?: boolean @@ -11966,7 +11966,7 @@ export interface IndicesAddBlockRequest extends RequestBase { export interface IndicesAddBlockResponse { acknowledged: boolean shards_acknowledged: boolean - indices: IndicesAddBlockIndicesBlockStatus[] + indices: IndicesIndicesBlockStatus[] } export interface IndicesAnalyzeAnalyzeDetail { @@ -12965,6 +12965,21 @@ export interface IndicesReloadSearchAnalyzersRequest extends RequestBase { export type IndicesReloadSearchAnalyzersResponse = IndicesReloadSearchAnalyzersReloadResult +export interface IndicesRemoveBlockRequest extends RequestBase { + index: IndexName + block: IndicesIndicesBlockOptions + allow_no_indices?: boolean + expand_wildcards?: ExpandWildcards + ignore_unavailable?: boolean + master_timeout?: Duration + timeout?: Duration +} + +export interface IndicesRemoveBlockResponse { + acknowledged: boolean + indices: IndicesIndicesBlockStatus[] +} + export interface IndicesResolveClusterRequest extends RequestBase { name?: Names allow_no_indices?: boolean diff --git a/specification/indices/_types/IndexSettings.ts b/specification/indices/_types/IndexSettings.ts index c416167cce..1d78d338dc 100644 --- a/specification/indices/_types/IndexSettings.ts +++ b/specification/indices/_types/IndexSettings.ts @@ -24,6 +24,7 @@ import { TokenFilter } from '@_types/analysis/token_filters' import { Tokenizer } from '@_types/analysis/tokenizers' import { ByteSize, + IndexName, Name, PipelineName, Uuid, @@ -269,6 +270,22 @@ export class IndexSettingBlocks { metadata?: Stringified } +export enum IndicesBlockOptions { + /** Disable metadata changes, such as closing the index. */ + metadata, + /** Disable read operations. */ + read, + /** Disable write operations and metadata changes. */ + read_only, + /** Disable write operations. However, metadata changes are still allowed. */ + write +} + +export class IndicesBlockStatus { + name: IndexName + blocked: boolean +} + /** * @es_quirk This is a boolean that evolved into an enum. ES also accepts plain booleans for true and false. */ diff --git a/specification/indices/add_block/IndicesAddBlockRequest.ts b/specification/indices/add_block/IndicesAddBlockRequest.ts index 4e553ccb3e..8b4768931d 100644 --- a/specification/indices/add_block/IndicesAddBlockRequest.ts +++ b/specification/indices/add_block/IndicesAddBlockRequest.ts @@ -20,6 +20,7 @@ import { RequestBase } from '@_types/Base' import { ExpandWildcards, IndexName } from '@_types/common' import { Duration } from '@_types/Time' +import { IndicesBlockOptions } from '@indices/_types/IndexSettings' /** * Add an index block. @@ -87,14 +88,3 @@ export interface Request extends RequestBase { timeout?: Duration // default: 30s } } - -export enum IndicesBlockOptions { - /** Disable metadata changes, such as closing the index. */ - metadata, - /** Disable read operations. */ - read, - /** Disable write operations and metadata changes. */ - read_only, - /** Disable write operations. However, metadata changes are still allowed. */ - write -} diff --git a/specification/indices/add_block/IndicesAddBlockResponse.ts b/specification/indices/add_block/IndicesAddBlockResponse.ts index b6b89b827f..88153a7c8d 100644 --- a/specification/indices/add_block/IndicesAddBlockResponse.ts +++ b/specification/indices/add_block/IndicesAddBlockResponse.ts @@ -17,7 +17,7 @@ * under the License. */ -import { IndexName } from '@_types/common' +import { IndicesBlockStatus } from '@indices/_types/IndexSettings' export class Response { body: { @@ -26,8 +26,3 @@ export class Response { indices: IndicesBlockStatus[] } } - -export class IndicesBlockStatus { - name: IndexName - blocked: boolean -} diff --git a/specification/indices/remove_block/IndicesRemoveBlockRequest.ts b/specification/indices/remove_block/IndicesRemoveBlockRequest.ts index 08586e8736..f6e2a374e2 100644 --- a/specification/indices/remove_block/IndicesRemoveBlockRequest.ts +++ b/specification/indices/remove_block/IndicesRemoveBlockRequest.ts @@ -20,6 +20,7 @@ import { RequestBase } from '@_types/Base' import { ExpandWildcards, IndexName } from '@_types/common' import { Duration } from '@_types/Time' +import { IndicesBlockOptions } from '@indices/_types/IndexSettings' /** * Remove an index block. @@ -87,14 +88,3 @@ export interface Request extends RequestBase { timeout?: Duration // default: 30s } } - -export enum IndicesBlockOptions { - /** Disable metadata changes, such as closing the index. */ - metadata, - /** Disable read operations. */ - read, - /** Disable write operations and metadata changes. */ - read_only, - /** Disable write operations. However, metadata changes are still allowed. */ - write -} diff --git a/specification/indices/remove_block/IndicesRemoveBlockResponse.ts b/specification/indices/remove_block/IndicesRemoveBlockResponse.ts index d8d63beab3..3a97f01c20 100644 --- a/specification/indices/remove_block/IndicesRemoveBlockResponse.ts +++ b/specification/indices/remove_block/IndicesRemoveBlockResponse.ts @@ -17,7 +17,7 @@ * under the License. */ -import { IndexName } from '@_types/common' +import { IndicesBlockStatus } from '@indices/_types/IndexSettings' export class Response { body: { @@ -25,8 +25,3 @@ export class Response { indices: IndicesBlockStatus[] } } - -export class IndicesBlockStatus { - name: IndexName - unblocked: boolean -} From 5758ef9cd992f4d2ed05a8a31ab8e808188548db Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 27 Jun 2025 16:23:52 +0400 Subject: [PATCH 6/9] Separate BlockStatus as it is different --- output/openapi/elasticsearch-openapi.json | 21 ++- .../elasticsearch-serverless-openapi.json | 21 ++- output/schema/schema.json | 166 +++++++++++------- output/typescript/types.ts | 19 +- specification/indices/_types/IndexSettings.ts | 6 - .../add_block/IndicesAddBlockResponse.ts | 9 +- .../IndicesRemoveBlockResponse.ts | 9 +- 7 files changed, 161 insertions(+), 90 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index bf932c3e5b..fc5eabdcc9 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -12735,7 +12735,7 @@ "indices": { "type": "array", "items": { - "$ref": "#/components/schemas/indices._types.IndicesBlockStatus" + "$ref": "#/components/schemas/indices.add_block.AddIndicesBlockStatus" } } }, @@ -12853,7 +12853,7 @@ "indices": { "type": "array", "items": { - "$ref": "#/components/schemas/indices._types.IndicesBlockStatus" + "$ref": "#/components/schemas/indices.remove_block.RemoveIndicesBlockStatus" } } }, @@ -79016,7 +79016,7 @@ "write" ] }, - "indices._types.IndicesBlockStatus": { + "indices.add_block.AddIndicesBlockStatus": { "type": "object", "properties": { "name": { @@ -80434,6 +80434,21 @@ "reloaded_node_ids" ] }, + "indices.remove_block.RemoveIndicesBlockStatus": { + "type": "object", + "properties": { + "name": { + "$ref": "#/components/schemas/_types.IndexName" + }, + "unblocked": { + "type": "boolean" + } + }, + "required": [ + "name", + "unblocked" + ] + }, "indices.resolve_cluster.ResolveClusterInfo": { "description": "Provides information about each cluster request relevant to doing a cross-cluster search.", "type": "object", diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index d2265d271b..85e4570200 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -6700,7 +6700,7 @@ "indices": { "type": "array", "items": { - "$ref": "#/components/schemas/indices._types.IndicesBlockStatus" + "$ref": "#/components/schemas/indices.add_block.AddIndicesBlockStatus" } } }, @@ -6818,7 +6818,7 @@ "indices": { "type": "array", "items": { - "$ref": "#/components/schemas/indices._types.IndicesBlockStatus" + "$ref": "#/components/schemas/indices.remove_block.RemoveIndicesBlockStatus" } } }, @@ -51039,7 +51039,7 @@ "write" ] }, - "indices._types.IndicesBlockStatus": { + "indices.add_block.AddIndicesBlockStatus": { "type": "object", "properties": { "name": { @@ -51835,6 +51835,21 @@ } } }, + "indices.remove_block.RemoveIndicesBlockStatus": { + "type": "object", + "properties": { + "name": { + "$ref": "#/components/schemas/_types.IndexName" + }, + "unblocked": { + "type": "boolean" + } + }, + "required": [ + "name", + "unblocked" + ] + }, "indices.resolve_index.ResolveIndexItem": { "type": "object", "properties": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 343f06ebb5..ba59e57b94 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -140876,7 +140876,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L440-L442" + "specLocation": "indices/_types/IndexSettings.ts#L435-L437" }, { "kind": "interface", @@ -141894,7 +141894,7 @@ "name": "IndexCheckOnStartup", "namespace": "indices._types" }, - "specLocation": "indices/_types/IndexSettings.ts#L289-L296" + "specLocation": "indices/_types/IndexSettings.ts#L284-L291" }, { "kind": "enum", @@ -143307,7 +143307,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L352-L358" + "specLocation": "indices/_types/IndexSettings.ts#L347-L353" }, { "kind": "interface", @@ -143425,7 +143425,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L303-L342" + "specLocation": "indices/_types/IndexSettings.ts#L298-L337" }, { "kind": "interface", @@ -143447,7 +143447,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L344-L350" + "specLocation": "indices/_types/IndexSettings.ts#L339-L345" }, { "kind": "interface", @@ -143479,7 +143479,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L360-L363" + "specLocation": "indices/_types/IndexSettings.ts#L355-L358" }, { "kind": "interface", @@ -143900,7 +143900,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L298-L301" + "specLocation": "indices/_types/IndexSettings.ts#L293-L296" }, { "kind": "interface", @@ -143921,7 +143921,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L594-L596" + "specLocation": "indices/_types/IndexSettings.ts#L589-L591" }, { "kind": "interface", @@ -143943,7 +143943,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L598-L605" + "specLocation": "indices/_types/IndexSettings.ts#L593-L600" }, { "kind": "interface", @@ -143997,7 +143997,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L607-L612" + "specLocation": "indices/_types/IndexSettings.ts#L602-L607" }, { "kind": "interface", @@ -144021,7 +144021,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L614-L621" + "specLocation": "indices/_types/IndexSettings.ts#L609-L616" }, { "kind": "enum", @@ -144049,38 +144049,6 @@ }, "specLocation": "indices/_types/IndexSettings.ts#L273-L282" }, - { - "kind": "interface", - "name": { - "name": "IndicesBlockStatus", - "namespace": "indices._types" - }, - "properties": [ - { - "name": "name", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "IndexName", - "namespace": "_types" - } - } - }, - { - "name": "blocked", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "boolean", - "namespace": "_builtins" - } - } - } - ], - "specLocation": "indices/_types/IndexSettings.ts#L284-L287" - }, { "kind": "enum", "members": [ @@ -144225,7 +144193,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L444-L458" + "specLocation": "indices/_types/IndexSettings.ts#L439-L453" }, { "kind": "interface", @@ -144248,7 +144216,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L479-L486" + "specLocation": "indices/_types/IndexSettings.ts#L474-L481" }, { "kind": "interface", @@ -144270,7 +144238,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L516-L522" + "specLocation": "indices/_types/IndexSettings.ts#L511-L517" }, { "kind": "interface", @@ -144292,7 +144260,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L507-L514" + "specLocation": "indices/_types/IndexSettings.ts#L502-L509" }, { "kind": "interface", @@ -144315,7 +144283,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L488-L496" + "specLocation": "indices/_types/IndexSettings.ts#L483-L491" }, { "kind": "interface", @@ -144338,7 +144306,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L498-L505" + "specLocation": "indices/_types/IndexSettings.ts#L493-L500" }, { "kind": "interface", @@ -144359,7 +144327,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L524-L526" + "specLocation": "indices/_types/IndexSettings.ts#L519-L521" }, { "kind": "interface", @@ -144419,7 +144387,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L460-L477" + "specLocation": "indices/_types/IndexSettings.ts#L455-L472" }, { "kind": "interface", @@ -144440,7 +144408,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L365-L367" + "specLocation": "indices/_types/IndexSettings.ts#L360-L362" }, { "kind": "interface", @@ -144490,7 +144458,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L369-L372" + "specLocation": "indices/_types/IndexSettings.ts#L364-L367" }, { "kind": "interface", @@ -144548,7 +144516,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L436-L438" + "specLocation": "indices/_types/IndexSettings.ts#L431-L433" }, { "kind": "interface", @@ -145194,7 +145162,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L534-L539" + "specLocation": "indices/_types/IndexSettings.ts#L529-L534" }, { "kind": "interface", @@ -145248,7 +145216,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L546-L551" + "specLocation": "indices/_types/IndexSettings.ts#L541-L546" }, { "kind": "interface", @@ -145280,7 +145248,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L541-L544" + "specLocation": "indices/_types/IndexSettings.ts#L536-L539" }, { "kind": "interface", @@ -145334,7 +145302,7 @@ "name": "SourceMode", "namespace": "indices._types" }, - "specLocation": "indices/_types/IndexSettings.ts#L528-L532" + "specLocation": "indices/_types/IndexSettings.ts#L523-L527" }, { "kind": "interface", @@ -145367,7 +145335,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L553-L562" + "specLocation": "indices/_types/IndexSettings.ts#L548-L557" }, { "kind": "enum", @@ -145394,7 +145362,7 @@ "name": "StorageType", "namespace": "indices._types" }, - "specLocation": "indices/_types/IndexSettings.ts#L564-L592" + "specLocation": "indices/_types/IndexSettings.ts#L559-L587" }, { "kind": "interface", @@ -145551,7 +145519,7 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L374-L396" + "specLocation": "indices/_types/IndexSettings.ts#L369-L391" }, { "kind": "enum", @@ -145575,7 +145543,7 @@ "name": "TranslogDurability", "namespace": "indices._types" }, - "specLocation": "indices/_types/IndexSettings.ts#L398-L413" + "specLocation": "indices/_types/IndexSettings.ts#L393-L408" }, { "kind": "interface", @@ -145611,7 +145579,39 @@ } } ], - "specLocation": "indices/_types/IndexSettings.ts#L415-L434" + "specLocation": "indices/_types/IndexSettings.ts#L410-L429" + }, + { + "kind": "interface", + "name": { + "name": "AddIndicesBlockStatus", + "namespace": "indices.add_block" + }, + "properties": [ + { + "name": "name", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "IndexName", + "namespace": "_types" + } + } + }, + { + "name": "blocked", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "indices/add_block/IndicesAddBlockResponse.ts#L30-L33" }, { "kind": "request", @@ -145793,8 +145793,8 @@ "value": { "kind": "instance_of", "type": { - "name": "IndicesBlockStatus", - "namespace": "indices._types" + "name": "AddIndicesBlockStatus", + "namespace": "indices.add_block" } } } @@ -157761,6 +157761,38 @@ }, "specLocation": "indices/reload_search_analyzers/ReloadSearchAnalyzersResponse.ts#L22-L25" }, + { + "kind": "interface", + "name": { + "name": "RemoveIndicesBlockStatus", + "namespace": "indices.remove_block" + }, + "properties": [ + { + "name": "name", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "IndexName", + "namespace": "_types" + } + } + }, + { + "name": "unblocked", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "indices/remove_block/IndicesRemoveBlockResponse.ts#L29-L32" + }, { "kind": "request", "attachedBehaviors": [ @@ -157930,8 +157962,8 @@ "value": { "kind": "instance_of", "type": { - "name": "IndicesBlockStatus", - "namespace": "indices._types" + "name": "RemoveIndicesBlockStatus", + "namespace": "indices.remove_block" } } } diff --git a/output/typescript/types.ts b/output/typescript/types.ts index adbcab58de..ab47100ed9 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -11751,11 +11751,6 @@ export interface IndicesIndexingSlowlogTresholds { export type IndicesIndicesBlockOptions = 'metadata' | 'read' | 'read_only' | 'write' -export interface IndicesIndicesBlockStatus { - name: IndexName - blocked: boolean -} - export type IndicesManagedBy = 'Index Lifecycle Management' | 'Data stream lifecycle' | 'Unmanaged' export interface IndicesMappingLimitSettings { @@ -11953,6 +11948,11 @@ export interface IndicesTranslogRetention { age?: Duration } +export interface IndicesAddBlockAddIndicesBlockStatus { + name: IndexName + blocked: boolean +} + export interface IndicesAddBlockRequest extends RequestBase { index: IndexName block: IndicesIndicesBlockOptions @@ -11966,7 +11966,7 @@ export interface IndicesAddBlockRequest extends RequestBase { export interface IndicesAddBlockResponse { acknowledged: boolean shards_acknowledged: boolean - indices: IndicesIndicesBlockStatus[] + indices: IndicesAddBlockAddIndicesBlockStatus[] } export interface IndicesAnalyzeAnalyzeDetail { @@ -12965,6 +12965,11 @@ export interface IndicesReloadSearchAnalyzersRequest extends RequestBase { export type IndicesReloadSearchAnalyzersResponse = IndicesReloadSearchAnalyzersReloadResult +export interface IndicesRemoveBlockRemoveIndicesBlockStatus { + name: IndexName + unblocked: boolean +} + export interface IndicesRemoveBlockRequest extends RequestBase { index: IndexName block: IndicesIndicesBlockOptions @@ -12977,7 +12982,7 @@ export interface IndicesRemoveBlockRequest extends RequestBase { export interface IndicesRemoveBlockResponse { acknowledged: boolean - indices: IndicesIndicesBlockStatus[] + indices: IndicesRemoveBlockRemoveIndicesBlockStatus[] } export interface IndicesResolveClusterRequest extends RequestBase { diff --git a/specification/indices/_types/IndexSettings.ts b/specification/indices/_types/IndexSettings.ts index 1d78d338dc..18e53364cc 100644 --- a/specification/indices/_types/IndexSettings.ts +++ b/specification/indices/_types/IndexSettings.ts @@ -24,7 +24,6 @@ import { TokenFilter } from '@_types/analysis/token_filters' import { Tokenizer } from '@_types/analysis/tokenizers' import { ByteSize, - IndexName, Name, PipelineName, Uuid, @@ -281,11 +280,6 @@ export enum IndicesBlockOptions { write } -export class IndicesBlockStatus { - name: IndexName - blocked: boolean -} - /** * @es_quirk This is a boolean that evolved into an enum. ES also accepts plain booleans for true and false. */ diff --git a/specification/indices/add_block/IndicesAddBlockResponse.ts b/specification/indices/add_block/IndicesAddBlockResponse.ts index 88153a7c8d..35caca4736 100644 --- a/specification/indices/add_block/IndicesAddBlockResponse.ts +++ b/specification/indices/add_block/IndicesAddBlockResponse.ts @@ -17,12 +17,17 @@ * under the License. */ -import { IndicesBlockStatus } from '@indices/_types/IndexSettings' +import { IndexName } from '@_types/common' export class Response { body: { acknowledged: boolean shards_acknowledged: boolean - indices: IndicesBlockStatus[] + indices: AddIndicesBlockStatus[] } } + +export class AddIndicesBlockStatus { + name: IndexName + blocked: boolean +} diff --git a/specification/indices/remove_block/IndicesRemoveBlockResponse.ts b/specification/indices/remove_block/IndicesRemoveBlockResponse.ts index 3a97f01c20..714037e8d5 100644 --- a/specification/indices/remove_block/IndicesRemoveBlockResponse.ts +++ b/specification/indices/remove_block/IndicesRemoveBlockResponse.ts @@ -17,11 +17,16 @@ * under the License. */ -import { IndicesBlockStatus } from '@indices/_types/IndexSettings' +import { IndexName } from '@_types/common' export class Response { body: { acknowledged: boolean - indices: IndicesBlockStatus[] + indices: RemoveIndicesBlockStatus[] } } + +export class RemoveIndicesBlockStatus { + name: IndexName + unblocked: boolean +} From 15ac1d04f85749c027a6d05dfa1b7c7c9ffebe27 Mon Sep 17 00:00:00 2001 From: Niels Bauman Date: Wed, 2 Jul 2025 13:17:53 -0300 Subject: [PATCH 7/9] Rename response example file --- ...ponseExample1.yaml => IndicesRemoveBlockResponseExample1.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename specification/indices/remove_block/examples/response/{IndicesAddBlockResponseExample1.yaml => IndicesRemoveBlockResponseExample1.yaml} (100%) diff --git a/specification/indices/remove_block/examples/response/IndicesAddBlockResponseExample1.yaml b/specification/indices/remove_block/examples/response/IndicesRemoveBlockResponseExample1.yaml similarity index 100% rename from specification/indices/remove_block/examples/response/IndicesAddBlockResponseExample1.yaml rename to specification/indices/remove_block/examples/response/IndicesRemoveBlockResponseExample1.yaml From 388072ac6aecb36bd9282b0bd0a25ba09f516a48 Mon Sep 17 00:00:00 2001 From: Niels Bauman Date: Wed, 2 Jul 2025 13:23:24 -0300 Subject: [PATCH 8/9] Fix response fields --- .../indices/remove_block/IndicesRemoveBlockResponse.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/specification/indices/remove_block/IndicesRemoveBlockResponse.ts b/specification/indices/remove_block/IndicesRemoveBlockResponse.ts index 714037e8d5..0487a78ced 100644 --- a/specification/indices/remove_block/IndicesRemoveBlockResponse.ts +++ b/specification/indices/remove_block/IndicesRemoveBlockResponse.ts @@ -18,6 +18,7 @@ */ import { IndexName } from '@_types/common' +import { ErrorCause } from "@_types/Errors"; export class Response { body: { @@ -28,5 +29,6 @@ export class Response { export class RemoveIndicesBlockStatus { name: IndexName - unblocked: boolean + unblocked?: boolean + exception?: ErrorCause } From 20c04f17db5847831245eed3b0897c8f745f6855 Mon Sep 17 00:00:00 2001 From: Niels Bauman Date: Thu, 3 Jul 2025 09:25:23 -0300 Subject: [PATCH 9/9] Add index privilege --- specification/indices/remove_block/IndicesRemoveBlockRequest.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/specification/indices/remove_block/IndicesRemoveBlockRequest.ts b/specification/indices/remove_block/IndicesRemoveBlockRequest.ts index f6e2a374e2..027c3aa75d 100644 --- a/specification/indices/remove_block/IndicesRemoveBlockRequest.ts +++ b/specification/indices/remove_block/IndicesRemoveBlockRequest.ts @@ -31,6 +31,7 @@ import { IndicesBlockOptions } from '@indices/_types/IndexSettings' * @availability stack since=9.1.0 stability=stable * @availability serverless stability=stable visibility=public * @doc_id index-block-remove + * @index_privileges manage */ export interface Request extends RequestBase { urls: [