From de20075c31c736839c683e9a9c7e93ca94124083 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Wed, 26 Nov 2025 12:06:49 +0400 Subject: [PATCH 1/3] Add private capabilities API --- specification/_doc_ids/table.csv | 1 + .../capabilities/CapabilitiesRequest.ts | 75 +++++++++++++++++++ .../capabilities/CapabilitiesResponse.ts | 29 +++++++ 3 files changed, 105 insertions(+) create mode 100644 specification/_global/capabilities/CapabilitiesRequest.ts create mode 100644 specification/_global/capabilities/CapabilitiesResponse.ts diff --git a/specification/_doc_ids/table.csv b/specification/_doc_ids/table.csv index 9a8c5d3fd9..2ea0796c79 100644 --- a/specification/_doc_ids/table.csv +++ b/specification/_doc_ids/table.csv @@ -48,6 +48,7 @@ behavioral-analytics-event-reference,https://www.elastic.co/guide/en/elasticsear byte-units,https://www.elastic.co/docs/reference/elasticsearch/rest-apis/api-conventions#byte-units,, bytes-processor,https://www.elastic.co/docs/reference/enrich-processor/bytes-processor,, calendar-and-fixed-intervals,https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-datehistogram-aggregation#calendar_and_fixed_intervals,, +capabilities,https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/README.asciidoc#require-or-skip-api-capabilities,, cat-alias,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cat-aliases,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-alias.html, cat-allocation,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cat-allocation,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-allocation.html, cat-anomaly-detectors,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cat-ml-jobs,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-anomaly-detectors.html, diff --git a/specification/_global/capabilities/CapabilitiesRequest.ts b/specification/_global/capabilities/CapabilitiesRequest.ts new file mode 100644 index 0000000000..76f6a33d61 --- /dev/null +++ b/specification/_global/capabilities/CapabilitiesRequest.ts @@ -0,0 +1,75 @@ +/* + * 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 { Duration } from '@_types/Time' + +/** + * Checks if the specified combination of method, API, parameters, and arbitrary capabilities are supported. + * + * @rest_spec_name capabilities + * @availability stack stability=experimental visibility=private + * @doc_id capabilities + */ +export interface Request extends RequestBase { + urls: [ + { + path: '/_capabilities' + methods: ['GET'] + } + ] + query_parameters: { + /** + * REST method to check + * @server_default GET + */ + method?: RestMethod + /** + * API path to check + * @server_default / + */ + path?: string + /** + * Comma-separated list of API parameters to check + */ + parameters?: string | string[] + /** + * Comma-separated list of arbitrary API capabilities to check + */ + capabilities?: string | string[] + /** + * True if only the node being called should be considered + * @server_default false + */ + local_only?: boolean + /** + * Period to wait for a response. + * If no response is received before the timeout expires, the request fails and returns an error. + */ + timeout?: Duration + } +} + +export enum RestMethod { + GET, + HEAD, + POST, + PUT, + DELETE +} diff --git a/specification/_global/capabilities/CapabilitiesResponse.ts b/specification/_global/capabilities/CapabilitiesResponse.ts new file mode 100644 index 0000000000..ea2540a307 --- /dev/null +++ b/specification/_global/capabilities/CapabilitiesResponse.ts @@ -0,0 +1,29 @@ +/* + * 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 { Name } from '@_types/common' +import { NodeStatistics } from '@_types/Node' + +export class Response { + body: { + _nodes: NodeStatistics + cluster_name: Name + supported: boolean | null + } +} From 0c91cb9d96fd67a7aa26bc2b34298e8883c60d45 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Thu, 27 Nov 2025 12:39:58 +0400 Subject: [PATCH 2/3] Add failures --- specification/_global/capabilities/CapabilitiesResponse.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/specification/_global/capabilities/CapabilitiesResponse.ts b/specification/_global/capabilities/CapabilitiesResponse.ts index ea2540a307..dcd078f7b3 100644 --- a/specification/_global/capabilities/CapabilitiesResponse.ts +++ b/specification/_global/capabilities/CapabilitiesResponse.ts @@ -17,7 +17,7 @@ * under the License. */ -import { Name } from '@_types/common' +import { Id, Name } from '@_types/common' import { NodeStatistics } from '@_types/Node' export class Response { @@ -25,5 +25,10 @@ export class Response { _nodes: NodeStatistics cluster_name: Name supported: boolean | null + failures?: FailedNodeException[] } } + +export class FailedNodeException { + node_id: Id +} \ No newline at end of file From bede0b4bcdbed6a8fcb1a626f13b96433dedf29f Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Thu, 27 Nov 2025 14:01:52 +0400 Subject: [PATCH 3/3] Run make spec-format-fix --- specification/_global/capabilities/CapabilitiesResponse.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/_global/capabilities/CapabilitiesResponse.ts b/specification/_global/capabilities/CapabilitiesResponse.ts index dcd078f7b3..b0be4db16e 100644 --- a/specification/_global/capabilities/CapabilitiesResponse.ts +++ b/specification/_global/capabilities/CapabilitiesResponse.ts @@ -31,4 +31,4 @@ export class Response { export class FailedNodeException { node_id: Id -} \ No newline at end of file +}