From b188afa4a5632b42a2d4d4cd80b347f1ea7ab2dc Mon Sep 17 00:00:00 2001 From: Michael Peterson Date: Mon, 15 Sep 2025 15:48:00 -0400 Subject: [PATCH 1/3] Adds project_routing to all cross-project search enabled Elasticsearch API --- output/openapi/elasticsearch-openapi.json | 10 ++ .../elasticsearch-serverless-openapi.json | 10 ++ output/schema/schema.json | 92 ++++++++++++++++--- output/typescript/types.ts | 4 + specification/_global/count/CountRequest.ts | 14 ++- .../field_caps/FieldCapabilitiesRequest.ts | 19 +++- .../_global/msearch/MultiSearchRequest.ts | 19 +++- specification/_global/msearch/types.ts | 9 +- .../MultiSearchTemplateRequest.ts | 14 ++- .../OpenPointInTimeRequest.ts | 14 ++- specification/_global/search/SearchRequest.ts | 7 +- .../_global/search_mvt/SearchMvtRequest.ts | 14 ++- .../search_template/SearchTemplateRequest.ts | 13 +++ specification/_json_spec/field_caps.json | 4 + .../_json_spec/indices.resolve_index.json | 4 + specification/_json_spec/msearch.json | 4 + .../submit/AsyncSearchSubmitRequest.ts | 7 +- specification/cat/count/CatCountRequest.ts | 14 ++- specification/eql/search/EqlSearchRequest.ts | 14 ++- .../resolve_index/ResolveIndexRequest.ts | 14 ++- specification/sql/query/QuerySqlRequest.ts | 13 +++ 21 files changed, 285 insertions(+), 28 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 43a46ee1a0..c71cc0c8eb 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -93915,6 +93915,13 @@ "preference": { "type": "string" }, + "project_routing": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.ProjectRouting" + } + ] + }, "request_cache": { "type": "boolean" }, @@ -93943,6 +93950,9 @@ } } }, + "_types.ProjectRouting": { + "type": "string" + }, "_global.msearch.ResponseItem": { "oneOf": [ { diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 5d9b9cf445..264a16ddd4 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -76789,6 +76789,13 @@ "preference": { "type": "string" }, + "project_routing": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.ProjectRouting" + } + ] + }, "request_cache": { "type": "boolean" }, @@ -76817,6 +76824,9 @@ } } }, + "_types.ProjectRouting": { + "type": "string" + }, "_global.msearch.MultiSearchResult": { "type": "object", "properties": { diff --git a/output/schema/schema.json b/output/schema/schema.json index cddcc91637..aec3c7ea94 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -29199,9 +29199,28 @@ "namespace": "_builtins" } } + }, + { + "availability": { + "serverless": { + "featureFlag": "serverless.cross_project.enabled", + "stability": "stable", + "visibility": "feature_flag" + } + }, + "description": "Specifies a subset of projects to target for the field-caps query using project\nmetadata tags in a subset of Lucene query syntax.\nAllowed Lucene queries: the _alias tag and a single value (possibly wildcarded).\nExamples:\n _alias:my-project\n _alias:_origin\n _alias:*pr*\nSupported in serverless only.", + "name": "project_routing", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ProjectRouting", + "namespace": "_types" + } + } } ], - "specLocation": "_global/field_caps/FieldCapabilitiesRequest.ts#L25-L130" + "specLocation": "_global/field_caps/FieldCapabilitiesRequest.ts#L30-L147" }, { "kind": "response", @@ -32989,7 +33008,7 @@ } } ], - "specLocation": "_global/msearch/types.ts#L58-L61" + "specLocation": "_global/msearch/types.ts#L65-L68" }, { "kind": "interface", @@ -33039,7 +33058,7 @@ } } ], - "specLocation": "_global/msearch/types.ts#L48-L51" + "specLocation": "_global/msearch/types.ts#L55-L58" }, { "kind": "interface", @@ -33104,6 +33123,17 @@ } } }, + { + "name": "project_routing", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ProjectRouting", + "namespace": "_types" + } + } + }, { "name": "request_cache", "required": false, @@ -33171,7 +33201,7 @@ } } ], - "specLocation": "_global/msearch/types.ts#L31-L46" + "specLocation": "_global/msearch/types.ts#L37-L53" }, { "kind": "request", @@ -33374,6 +33404,25 @@ } } }, + { + "availability": { + "serverless": { + "featureFlag": "serverless.cross_project.enabled", + "stability": "stable", + "visibility": "feature_flag" + } + }, + "description": "Specifies a subset of projects to target for a search using project metadata\ntags in a subset Lucene syntax. Allowed Lucene queries: the _alias tag\nand a single value (possible wildcarded). Examples:\n _alias:my-project\n _alias:_origin\n _alias:*pr*\nSupported in serverless only.", + "name": "project_routing", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ProjectRouting", + "namespace": "_types" + } + } + }, { "description": "If true, hits.total are returned as an integer in the response. Defaults to false, which returns an object.", "name": "rest_total_hits_as_int", @@ -33424,7 +33473,7 @@ } } ], - "specLocation": "_global/msearch/MultiSearchRequest.ts#L25-L140" + "specLocation": "_global/msearch/MultiSearchRequest.ts#L31-L157" }, { "kind": "type_alias", @@ -33436,7 +33485,7 @@ "name": "RequestItem", "namespace": "_global.msearch" }, - "specLocation": "_global/msearch/types.ts#L26-L29", + "specLocation": "_global/msearch/types.ts#L32-L35", "type": { "kind": "union_of", "items": [ @@ -33507,7 +33556,7 @@ "name": "ResponseItem", "namespace": "_global.msearch" }, - "specLocation": "_global/msearch/types.ts#L53-L56", + "specLocation": "_global/msearch/types.ts#L60-L63", "type": { "kind": "union_of", "items": [ @@ -38757,7 +38806,7 @@ "visibility": "feature_flag" } }, - "description": "Specifies a subset of projects to target for a search using project metadata\ntags in a subset Lucene syntax. Allowed Lucene queries: the _alias tag\nand a single value (possible wildcarded). Examples:\n _alias:my-project\n _alias:_origin\n _alias:*pr*\nSupported in serverless only.", + "description": "Specifies a subset of projects to target for the search using project\nmetadata tags in a subset of Lucene query syntax.\nAllowed Lucene queries: the _alias tag and a single value (possibly wildcarded).\nExamples:\n _alias:my-project\n _alias:_origin\n _alias:*pr*\nSupported in serverless only.", "name": "project_routing", "required": false, "type": { @@ -39147,7 +39196,7 @@ } } ], - "specLocation": "_global/search/SearchRequest.ts#L54-L607" + "specLocation": "_global/search/SearchRequest.ts#L54-L608" }, { "kind": "response", @@ -98631,7 +98680,7 @@ "visibility": "feature_flag" } }, - "description": "Specifies a subset of projects to target for a search using project metadata\ntags in a subset Lucene syntax. Allowed Lucene queries: the _alias tag\nand a single value (possible wildcarded). Examples:\n _alias:my-project\n _alias:_origin\n _alias:*pr*\nSupported in serverless only.", + "description": "Specifies a subset of projects to target for the search using project\nmetadata tags in a subset of Lucene query syntax.\nAllowed Lucene queries: the _alias tag and a single value (possibly wildcarded).\nExamples:\n _alias:my-project\n _alias:_origin\n _alias:*pr*\nSupported in serverless only.", "name": "project_routing", "required": false, "type": { @@ -98950,7 +98999,7 @@ } } ], - "specLocation": "async_search/submit/AsyncSearchSubmitRequest.ts#L55-L306" + "specLocation": "async_search/submit/AsyncSearchSubmitRequest.ts#L55-L307" }, { "kind": "response", @@ -164004,9 +164053,28 @@ } ] } + }, + { + "availability": { + "serverless": { + "featureFlag": "serverless.cross_project.enabled", + "stability": "stable", + "visibility": "feature_flag" + } + }, + "description": "Specifies a subset of projects to target using project\nmetadata tags in a subset of Lucene query syntax.\nAllowed Lucene queries: the _alias tag and a single value (possibly wildcarded).\nExamples:\n _alias:my-project\n _alias:_origin\n _alias:*pr*\nSupported in serverless only.", + "name": "project_routing", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ProjectRouting", + "namespace": "_types" + } + } } ], - "specLocation": "indices/resolve_index/ResolveIndexRequest.ts#L24-L75" + "specLocation": "indices/resolve_index/ResolveIndexRequest.ts#L24-L87" }, { "kind": "interface", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 1a46d6f8f0..9591f6514a 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -360,6 +360,7 @@ export interface FieldCapsRequest extends RequestBase { filters?: string types?: string[] include_empty_fields?: boolean + project_routing?: ProjectRouting body?: { fields?: Fields index_filter?: QueryDslQueryContainer @@ -742,6 +743,7 @@ export interface MsearchMultisearchHeader { ignore_unavailable?: boolean index?: Indices preference?: string + project_routing?: ProjectRouting request_cache?: boolean routing?: Routing search_type?: SearchType @@ -761,6 +763,7 @@ export interface MsearchRequest extends RequestBase { max_concurrent_searches?: integer max_concurrent_shard_requests?: integer pre_filter_shard_size?: long + project_routing?: ProjectRouting rest_total_hits_as_int?: boolean routing?: Routing search_type?: SearchType @@ -13307,6 +13310,7 @@ export interface IndicesResolveIndexRequest extends RequestBase { ignore_unavailable?: boolean allow_no_indices?: boolean mode?: IndicesIndexMode | IndicesIndexMode[] + project_routing?: ProjectRouting } export interface IndicesResolveIndexResolveIndexAliasItem { diff --git a/specification/_global/count/CountRequest.ts b/specification/_global/count/CountRequest.ts index af4202f271..921d53c246 100644 --- a/specification/_global/count/CountRequest.ts +++ b/specification/_global/count/CountRequest.ts @@ -18,7 +18,7 @@ */ import { RequestBase } from '@_types/Base' -import { ExpandWildcards, Indices, Routing } from '@_types/common' +import { ExpandWildcards, Indices, ProjectRouting, Routing } from '@_types/common' import { double, long } from '@_types/Numeric' import { QueryContainer } from '@_types/query_dsl/abstractions' import { Operator } from '@_types/query_dsl/Operator' @@ -124,6 +124,18 @@ export interface Request extends RequestBase { * By default, it is random. */ preference?: string + /** + * Specifies a subset of projects to target for the search using project + * metadata tags in a subset of Lucene query syntax. + * Allowed Lucene queries: the _alias tag and a single value (possibly wildcarded). + * Examples: + * _alias:my-project + * _alias:_origin + * _alias:*pr* + * Supported in serverless only. + * @availability serverless stability=stable visibility=feature_flag feature_flag=serverless.cross_project.enabled + */ + project_routing?: ProjectRouting /** * A custom value used to route operations to a specific shard. */ diff --git a/specification/_global/field_caps/FieldCapabilitiesRequest.ts b/specification/_global/field_caps/FieldCapabilitiesRequest.ts index 315c1b66f9..d1a24c0e6d 100644 --- a/specification/_global/field_caps/FieldCapabilitiesRequest.ts +++ b/specification/_global/field_caps/FieldCapabilitiesRequest.ts @@ -18,7 +18,12 @@ */ import { RequestBase } from '@_types/Base' -import { ExpandWildcards, Fields, Indices } from '@_types/common' +import { + ExpandWildcards, + Fields, + Indices, + ProjectRouting +} from '@_types/common' import { RuntimeFields } from '@_types/mapping/RuntimeFields' import { QueryContainer } from '@_types/query_dsl/abstractions' @@ -102,6 +107,18 @@ export interface Request extends RequestBase { * @server_default true */ include_empty_fields?: boolean + /** + * Specifies a subset of projects to target for the field-caps query using project + * metadata tags in a subset of Lucene query syntax. + * Allowed Lucene queries: the _alias tag and a single value (possibly wildcarded). + * Examples: + * _alias:my-project + * _alias:_origin + * _alias:*pr* + * Supported in serverless only. + * @availability serverless stability=stable visibility=feature_flag feature_flag=serverless.cross_project.enabled + */ + project_routing?: ProjectRouting } body: { /** diff --git a/specification/_global/msearch/MultiSearchRequest.ts b/specification/_global/msearch/MultiSearchRequest.ts index 4888c0666d..888b94ffba 100644 --- a/specification/_global/msearch/MultiSearchRequest.ts +++ b/specification/_global/msearch/MultiSearchRequest.ts @@ -18,7 +18,13 @@ */ import { RequestBase } from '@_types/Base' -import { ExpandWildcards, Indices, Routing, SearchType } from '@_types/common' +import { + ExpandWildcards, + Indices, + ProjectRouting, + Routing, + SearchType +} from '@_types/common' import { integer, long } from '@_types/Numeric' import { RequestItem } from './types' @@ -117,6 +123,17 @@ export interface Request extends RequestBase { * Defines a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method i.e., if date filters are mandatory to match but the shard bounds and the query are disjoint. */ pre_filter_shard_size?: long + /** + * Specifies a subset of projects to target for a search using project metadata + * tags in a subset Lucene syntax. Allowed Lucene queries: the _alias tag + * and a single value (possible wildcarded). Examples: + * _alias:my-project + * _alias:_origin + * _alias:*pr* + * Supported in serverless only. + * @availability serverless stability=stable visibility=feature_flag feature_flag=serverless.cross_project.enabled + */ + project_routing?: ProjectRouting /** * If true, hits.total are returned as an integer in the response. Defaults to false, which returns an object. * @server_default false diff --git a/specification/_global/msearch/types.ts b/specification/_global/msearch/types.ts index 836068f5a8..fbce7f4d0d 100644 --- a/specification/_global/msearch/types.ts +++ b/specification/_global/msearch/types.ts @@ -18,7 +18,13 @@ */ import { ErrorResponseBase } from '@_types/Base' -import { ExpandWildcards, Indices, Routing, SearchType } from '@_types/common' +import { + ExpandWildcards, + Indices, + ProjectRouting, + Routing, + SearchType +} from '@_types/common' import { integer, long } from '@_types/Numeric' import { SearchRequestBody } from '@global/search/_types/SearchRequestBody' import { ResponseBody as SearchResponse } from '@global/search/SearchResponse' @@ -37,6 +43,7 @@ export class MultisearchHeader { ignore_unavailable?: boolean index?: Indices preference?: string + project_routing?: ProjectRouting request_cache?: boolean routing?: Routing search_type?: SearchType diff --git a/specification/_global/msearch_template/MultiSearchTemplateRequest.ts b/specification/_global/msearch_template/MultiSearchTemplateRequest.ts index 8a3656d145..0a5db835b3 100644 --- a/specification/_global/msearch_template/MultiSearchTemplateRequest.ts +++ b/specification/_global/msearch_template/MultiSearchTemplateRequest.ts @@ -18,7 +18,7 @@ */ import { RequestBase } from '@_types/Base' -import { Indices, SearchType } from '@_types/common' +import { Indices, ProjectRouting, SearchType } from '@_types/common' import { long } from '@_types/Numeric' import { RequestItem } from './types' @@ -75,6 +75,18 @@ export interface Request extends RequestBase { * The maximum number of concurrent searches the API can run. */ max_concurrent_searches?: long + /** + * Specifies a subset of projects to target for the search using project + * metadata tags in a subset of Lucene query syntax. + * Allowed Lucene queries: the _alias tag and a single value (possibly wildcarded). + * Examples: + * _alias:my-project + * _alias:_origin + * _alias:*pr* + * Supported in serverless only. + * @availability serverless stability=stable visibility=feature_flag feature_flag=serverless.cross_project.enabled + */ + project_routing?: ProjectRouting /** * The type of the search operation. */ diff --git a/specification/_global/open_point_in_time/OpenPointInTimeRequest.ts b/specification/_global/open_point_in_time/OpenPointInTimeRequest.ts index c935925da0..41443534ed 100644 --- a/specification/_global/open_point_in_time/OpenPointInTimeRequest.ts +++ b/specification/_global/open_point_in_time/OpenPointInTimeRequest.ts @@ -18,7 +18,7 @@ */ import { RequestBase } from '@_types/Base' -import { ExpandWildcards, Indices, Routing } from '@_types/common' +import { ExpandWildcards, Indices, ProjectRouting, Routing } from '@_types/common' import { integer } from '@_types/Numeric' import { QueryContainer } from '@_types/query_dsl/abstractions' import { Duration } from '@_types/Time' @@ -94,6 +94,18 @@ export interface Request extends RequestBase { * By default, it is random. */ preference?: string + /** + * Specifies a subset of projects to target for the PIT request using project + * metadata tags in a subset of Lucene query syntax. + * Allowed Lucene queries: the _alias tag and a single value (possibly wildcarded). + * Examples: + * _alias:my-project + * _alias:_origin + * _alias:*pr* + * Supported in serverless only. + * @availability serverless stability=stable visibility=feature_flag feature_flag=serverless.cross_project.enabled + */ + project_routing?: ProjectRouting /** * A custom value that is used to route operations to a specific shard. */ diff --git a/specification/_global/search/SearchRequest.ts b/specification/_global/search/SearchRequest.ts index 40a0187d19..1e5563994f 100644 --- a/specification/_global/search/SearchRequest.ts +++ b/specification/_global/search/SearchRequest.ts @@ -221,9 +221,10 @@ export interface Request extends RequestBase { */ pre_filter_shard_size?: long /** - * Specifies a subset of projects to target for a search using project metadata - * tags in a subset Lucene syntax. Allowed Lucene queries: the _alias tag - * and a single value (possible wildcarded). Examples: + * Specifies a subset of projects to target for the search using project + * metadata tags in a subset of Lucene query syntax. + * Allowed Lucene queries: the _alias tag and a single value (possibly wildcarded). + * Examples: * _alias:my-project * _alias:_origin * _alias:*pr* diff --git a/specification/_global/search_mvt/SearchMvtRequest.ts b/specification/_global/search_mvt/SearchMvtRequest.ts index d484884d9a..63e128901d 100644 --- a/specification/_global/search_mvt/SearchMvtRequest.ts +++ b/specification/_global/search_mvt/SearchMvtRequest.ts @@ -19,7 +19,7 @@ import { AggregationContainer } from '@_types/aggregations/AggregationContainer' import { RequestBase } from '@_types/Base' -import { Field, Fields, Indices } from '@_types/common' +import { Field, Fields, Indices, ProjectRouting } from '@_types/common' import { RuntimeFields } from '@_types/mapping/RuntimeFields' import { integer } from '@_types/Numeric' import { QueryContainer } from '@_types/query_dsl/abstractions' @@ -194,6 +194,18 @@ export interface Request extends RequestBase { * @server_default grid */ grid_type?: GridType + /** + * Specifies a subset of projects to target for the search using project + * metadata tags in a subset of Lucene query syntax. + * Allowed Lucene queries: the _alias tag and a single value (possibly wildcarded). + * Examples: + * _alias:my-project + * _alias:_origin + * _alias:*pr* + * Supported in serverless only. + * @availability serverless stability=stable visibility=feature_flag feature_flag=serverless.cross_project.enabled + */ + project_routing?: ProjectRouting /** * Maximum number of features to return in the hits layer. Accepts 0-10000. * If 0, results don't include the hits layer. diff --git a/specification/_global/search_template/SearchTemplateRequest.ts b/specification/_global/search_template/SearchTemplateRequest.ts index e6393bd7d5..fd4772cd50 100644 --- a/specification/_global/search_template/SearchTemplateRequest.ts +++ b/specification/_global/search_template/SearchTemplateRequest.ts @@ -22,6 +22,7 @@ import { ExpandWildcards, Id, Indices, + ProjectRouting, Routing, SearchType } from '@_types/common' @@ -99,6 +100,18 @@ export interface Request extends RequestBase { * If `true`, the query execution is profiled. * @server_default false */ profile?: boolean + /** + * Specifies a subset of projects to target for the search using project + * metadata tags in a subset of Lucene query syntax. + * Allowed Lucene queries: the _alias tag and a single value (possibly wildcarded). + * Examples: + * _alias:my-project + * _alias:_origin + * _alias:*pr* + * Supported in serverless only. + * @availability serverless stability=stable visibility=feature_flag feature_flag=serverless.cross_project.enabled + */ + project_routing?: ProjectRouting /** A custom value used to route operations to a specific shard. */ routing?: Routing /** diff --git a/specification/_json_spec/field_caps.json b/specification/_json_spec/field_caps.json index 51d6924021..05322eb496 100644 --- a/specification/_json_spec/field_caps.json +++ b/specification/_json_spec/field_caps.json @@ -64,6 +64,10 @@ "type": "boolean", "default": true, "description": "Include empty fields in result" + }, + "project_routing": { + "type": "string", + "description": "A Lucene query using project metadata tags to limit which projects to include, such as _alias:_origin or _alias:*pr*. Only supported in serverless." } }, "body": { diff --git a/specification/_json_spec/indices.resolve_index.json b/specification/_json_spec/indices.resolve_index.json index d3e23cc24b..7facc52d55 100644 --- a/specification/_json_spec/indices.resolve_index.json +++ b/specification/_json_spec/indices.resolve_index.json @@ -45,6 +45,10 @@ "options": ["standard", "time_series", "logsdb", "lookup"], "default": "", "description": "Filter indices by index mode. Comma-separated list of IndexMode. Empty means no filter." + }, + "project_routing": { + "type": "string", + "description": "A Lucene query using project metadata tags to limit which projects to include, such as _alias:_origin or _alias:*pr*. Only supported in serverless." } } } diff --git a/specification/_json_spec/msearch.json b/specification/_json_spec/msearch.json index 2aaf0586e2..4c96ce0476 100644 --- a/specification/_json_spec/msearch.json +++ b/specification/_json_spec/msearch.json @@ -84,6 +84,10 @@ "default": "open", "description": "Whether to expand wildcard expression to concrete indices that are open, closed or both." }, + "project_routing": { + "type": "string", + "description": "A Lucene query using project metadata tags to limit which projects to search, such as _alias:_origin or _alias:*pr*. Only supported in serverless." + }, "routing": { "type": "list", "description": "A comma-separated list of specific routing values" diff --git a/specification/async_search/submit/AsyncSearchSubmitRequest.ts b/specification/async_search/submit/AsyncSearchSubmitRequest.ts index 08ee9b9e45..fc71e1e164 100644 --- a/specification/async_search/submit/AsyncSearchSubmitRequest.ts +++ b/specification/async_search/submit/AsyncSearchSubmitRequest.ts @@ -128,9 +128,10 @@ export interface Request extends RequestBase { max_concurrent_shard_requests?: integer preference?: string /** - * Specifies a subset of projects to target for a search using project metadata - * tags in a subset Lucene syntax. Allowed Lucene queries: the _alias tag - * and a single value (possible wildcarded). Examples: + * Specifies a subset of projects to target for the search using project + * metadata tags in a subset of Lucene query syntax. + * Allowed Lucene queries: the _alias tag and a single value (possibly wildcarded). + * Examples: * _alias:my-project * _alias:_origin * _alias:*pr* diff --git a/specification/cat/count/CatCountRequest.ts b/specification/cat/count/CatCountRequest.ts index a1b3b5f087..1ef7349c98 100644 --- a/specification/cat/count/CatCountRequest.ts +++ b/specification/cat/count/CatCountRequest.ts @@ -17,7 +17,7 @@ * under the License. */ -import { Indices, Names } from '@_types/common' +import { Indices, Names, ProjectRouting } from '@_types/common' import { CatCountColumns, CatRequestBase } from '@cat/_types/CatBase' /** @@ -58,6 +58,18 @@ export interface Request extends CatRequestBase { * A comma-separated list of columns names to display. It supports simple wildcards. */ h?: CatCountColumns + /** + * Specifies a subset of projects to target for the search using project + * metadata tags in a subset of Lucene query syntax. + * Allowed Lucene queries: the _alias tag and a single value (possibly wildcarded). + * Examples: + * _alias:my-project + * _alias:_origin + * _alias:*pr* + * Supported in serverless only. + * @availability serverless stability=stable visibility=feature_flag feature_flag=serverless.cross_project.enabled + */ + project_routing?: ProjectRouting /** * List of columns that determine how the table should be sorted. * Sorting defaults to ascending and can be changed by setting `:asc` diff --git a/specification/eql/search/EqlSearchRequest.ts b/specification/eql/search/EqlSearchRequest.ts index 7365746f20..8955ad7efa 100644 --- a/specification/eql/search/EqlSearchRequest.ts +++ b/specification/eql/search/EqlSearchRequest.ts @@ -18,7 +18,7 @@ */ import { RequestBase } from '@_types/Base' -import { ExpandWildcards, Field, Indices } from '@_types/common' +import { ExpandWildcards, Field, Indices, ProjectRouting } from '@_types/common' import { RuntimeFields } from '@_types/mapping/RuntimeFields' import { integer, uint } from '@_types/Numeric' import { FieldAndFormat, QueryContainer } from '@_types/query_dsl/abstractions' @@ -85,6 +85,18 @@ export interface Request extends RequestBase { * @server_default false */ keep_on_completion?: boolean + /** + * Specifies a subset of projects to target for the search using project + * metadata tags in a subset of Lucene query syntax. + * Allowed Lucene queries: the _alias tag and a single value (possibly wildcarded). + * Examples: + * _alias:my-project + * _alias:_origin + * _alias:*pr* + * Supported in serverless only. + * @availability serverless stability=stable visibility=feature_flag feature_flag=serverless.cross_project.enabled + */ + project_routing?: ProjectRouting /** * Timeout duration to wait for the request to finish. Defaults to no timeout, meaning the request waits for complete search results. */ diff --git a/specification/indices/resolve_index/ResolveIndexRequest.ts b/specification/indices/resolve_index/ResolveIndexRequest.ts index 7e58beee0f..65bad15e33 100644 --- a/specification/indices/resolve_index/ResolveIndexRequest.ts +++ b/specification/indices/resolve_index/ResolveIndexRequest.ts @@ -18,7 +18,7 @@ */ import { RequestBase } from '@_types/Base' -import { ExpandWildcards, Names } from '@_types/common' +import { ExpandWildcards, Names, ProjectRouting } from '@_types/common' import { IndexMode } from '@indices/_types/DataStream' /** @@ -71,5 +71,17 @@ export interface Request extends RequestBase { * @availability serverless stability=stable visibility=public */ mode?: IndexMode | IndexMode[] + /** + * Specifies a subset of projects to target using project + * metadata tags in a subset of Lucene query syntax. + * Allowed Lucene queries: the _alias tag and a single value (possibly wildcarded). + * Examples: + * _alias:my-project + * _alias:_origin + * _alias:*pr* + * Supported in serverless only. + * @availability serverless stability=stable visibility=feature_flag feature_flag=serverless.cross_project.enabled + */ + project_routing?: ProjectRouting } } diff --git a/specification/sql/query/QuerySqlRequest.ts b/specification/sql/query/QuerySqlRequest.ts index a32c279833..f0f631cd1a 100644 --- a/specification/sql/query/QuerySqlRequest.ts +++ b/specification/sql/query/QuerySqlRequest.ts @@ -18,6 +18,7 @@ */ import { RequestBase } from '@_types/Base' +import { ProjectRouting } from '@_types/common' import { RuntimeFields } from '@_types/mapping/RuntimeFields' import { integer } from '@_types/Numeric' import { QueryContainer } from '@_types/query_dsl/abstractions' @@ -48,6 +49,18 @@ export interface Request extends RequestBase { * @ext_doc_id sql-rest-format */ format?: SqlFormat + /** + * Specifies a subset of projects to target for the search using project + * metadata tags in a subset of Lucene query syntax. + * Allowed Lucene queries: the _alias tag and a single value (possibly wildcarded). + * Examples: + * _alias:my-project + * _alias:_origin + * _alias:*pr* + * Supported in serverless only. + * @availability serverless stability=stable visibility=feature_flag feature_flag=serverless.cross_project.enabled + */ + project_routing?: ProjectRouting } body: { /** From 96831224d83eea4705956d05cc5dc1ad8c1aa8ad Mon Sep 17 00:00:00 2001 From: Michael Peterson Date: Thu, 18 Sep 2025 16:37:09 -0400 Subject: [PATCH 2/3] Ran make steps --- output/schema/schema.json | 170 +++++++++++++++++- output/schema/validation-errors.json | 48 +++++ output/typescript/types.ts | 8 + specification/_global/count/CountRequest.ts | 7 +- .../OpenPointInTimeRequest.ts | 7 +- 5 files changed, 229 insertions(+), 11 deletions(-) diff --git a/output/schema/schema.json b/output/schema/schema.json index aec3c7ea94..3761f9a74d 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -26358,6 +26358,25 @@ } } }, + { + "availability": { + "serverless": { + "featureFlag": "serverless.cross_project.enabled", + "stability": "stable", + "visibility": "feature_flag" + } + }, + "description": "Specifies a subset of projects to target for the search using project\nmetadata tags in a subset of Lucene query syntax.\nAllowed Lucene queries: the _alias tag and a single value (possibly wildcarded).\nExamples:\n _alias:my-project\n _alias:_origin\n _alias:*pr*\nSupported in serverless only.", + "name": "project_routing", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ProjectRouting", + "namespace": "_types" + } + } + }, { "description": "A custom value used to route operations to a specific shard.", "name": "routing", @@ -26395,7 +26414,7 @@ } } ], - "specLocation": "_global/count/CountRequest.ts#L26-L154" + "specLocation": "_global/count/CountRequest.ts#L31-L171" }, { "kind": "response", @@ -33685,6 +33704,25 @@ } } }, + { + "availability": { + "serverless": { + "featureFlag": "serverless.cross_project.enabled", + "stability": "stable", + "visibility": "feature_flag" + } + }, + "description": "Specifies a subset of projects to target for the search using project\nmetadata tags in a subset of Lucene query syntax.\nAllowed Lucene queries: the _alias tag and a single value (possibly wildcarded).\nExamples:\n _alias:my-project\n _alias:_origin\n _alias:*pr*\nSupported in serverless only.", + "name": "project_routing", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ProjectRouting", + "namespace": "_types" + } + } + }, { "description": "The type of the search operation.", "name": "search_type", @@ -33724,7 +33762,7 @@ } } ], - "specLocation": "_global/msearch_template/MultiSearchTemplateRequest.ts#L25-L116" + "specLocation": "_global/msearch_template/MultiSearchTemplateRequest.ts#L25-L128" }, { "kind": "type_alias", @@ -34584,6 +34622,25 @@ } } }, + { + "availability": { + "serverless": { + "featureFlag": "serverless.cross_project.enabled", + "stability": "stable", + "visibility": "feature_flag" + } + }, + "description": "Specifies a subset of projects to target for the PIT request using project\nmetadata tags in a subset of Lucene query syntax.\nAllowed Lucene queries: the _alias tag and a single value (possibly wildcarded).\nExamples:\n _alias:my-project\n _alias:_origin\n _alias:*pr*\nSupported in serverless only.", + "name": "project_routing", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ProjectRouting", + "namespace": "_types" + } + } + }, { "description": "A custom value that is used to route operations to a specific shard.", "name": "routing", @@ -34636,7 +34693,7 @@ } } ], - "specLocation": "_global/open_point_in_time/OpenPointInTimeRequest.ts#L26-L127" + "specLocation": "_global/open_point_in_time/OpenPointInTimeRequest.ts#L31-L144" }, { "kind": "response", @@ -46059,6 +46116,25 @@ } } }, + { + "availability": { + "serverless": { + "featureFlag": "serverless.cross_project.enabled", + "stability": "stable", + "visibility": "feature_flag" + } + }, + "description": "Specifies a subset of projects to target for the search using project\nmetadata tags in a subset of Lucene query syntax.\nAllowed Lucene queries: the _alias tag and a single value (possibly wildcarded).\nExamples:\n _alias:my-project\n _alias:_origin\n _alias:*pr*\nSupported in serverless only.", + "name": "project_routing", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ProjectRouting", + "namespace": "_types" + } + } + }, { "description": "Maximum number of features to return in the hits layer. Accepts 0-10000.\nIf 0, results don't include the hits layer.", "name": "size", @@ -46098,7 +46174,7 @@ } } ], - "specLocation": "_global/search_mvt/SearchMvtRequest.ts#L33-L334" + "specLocation": "_global/search_mvt/SearchMvtRequest.ts#L33-L346" }, { "kind": "response", @@ -46834,6 +46910,25 @@ } } }, + { + "availability": { + "serverless": { + "featureFlag": "serverless.cross_project.enabled", + "stability": "stable", + "visibility": "feature_flag" + } + }, + "description": "Specifies a subset of projects to target for the search using project\nmetadata tags in a subset of Lucene query syntax.\nAllowed Lucene queries: the _alias tag and a single value (possibly wildcarded).\nExamples:\n _alias:my-project\n _alias:_origin\n _alias:*pr*\nSupported in serverless only.", + "name": "project_routing", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ProjectRouting", + "namespace": "_types" + } + } + }, { "description": "A custom value used to route operations to a specific shard.", "name": "routing", @@ -46903,7 +46998,7 @@ } } ], - "specLocation": "_global/search_template/SearchTemplateRequest.ts#L33-L153" + "specLocation": "_global/search_template/SearchTemplateRequest.ts#L34-L166" }, { "kind": "response", @@ -106189,6 +106284,25 @@ } } }, + { + "availability": { + "serverless": { + "featureFlag": "serverless.cross_project.enabled", + "stability": "stable", + "visibility": "feature_flag" + } + }, + "description": "Specifies a subset of projects to target for the search using project\nmetadata tags in a subset of Lucene query syntax.\nAllowed Lucene queries: the _alias tag and a single value (possibly wildcarded).\nExamples:\n _alias:my-project\n _alias:_origin\n _alias:*pr*\nSupported in serverless only.", + "name": "project_routing", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ProjectRouting", + "namespace": "_types" + } + } + }, { "description": "List of columns that determine how the table should be sorted.\nSorting defaults to ascending and can be changed by setting `:asc`\nor `:desc` as a suffix to the column name.", "name": "s", @@ -106202,7 +106316,7 @@ } } ], - "specLocation": "cat/count/CatCountRequest.ts#L23-L68" + "specLocation": "cat/count/CatCountRequest.ts#L23-L80" }, { "kind": "response", @@ -138983,6 +139097,25 @@ } } }, + { + "availability": { + "serverless": { + "featureFlag": "serverless.cross_project.enabled", + "stability": "stable", + "visibility": "feature_flag" + } + }, + "description": "Specifies a subset of projects to target for the search using project\nmetadata tags in a subset of Lucene query syntax.\nAllowed Lucene queries: the _alias tag and a single value (possibly wildcarded).\nExamples:\n _alias:my-project\n _alias:_origin\n _alias:*pr*\nSupported in serverless only.", + "name": "project_routing", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ProjectRouting", + "namespace": "_types" + } + } + }, { "description": "Timeout duration to wait for the request to finish. Defaults to no timeout, meaning the request waits for complete search results.", "name": "wait_for_completion_timeout", @@ -138996,7 +139129,7 @@ } } ], - "specLocation": "eql/search/EqlSearchRequest.ts#L28-L166" + "specLocation": "eql/search/EqlSearchRequest.ts#L28-L178" }, { "kind": "response", @@ -257550,9 +257683,28 @@ "namespace": "sql.query" } } + }, + { + "availability": { + "serverless": { + "featureFlag": "serverless.cross_project.enabled", + "stability": "stable", + "visibility": "feature_flag" + } + }, + "description": "Specifies a subset of projects to target for the search using project\nmetadata tags in a subset of Lucene query syntax.\nAllowed Lucene queries: the _alias tag and a single value (possibly wildcarded).\nExamples:\n _alias:my-project\n _alias:_origin\n _alias:*pr*\nSupported in serverless only.", + "name": "project_routing", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ProjectRouting", + "namespace": "_types" + } + } } ], - "specLocation": "sql/query/QuerySqlRequest.ts#L27-L151" + "specLocation": "sql/query/QuerySqlRequest.ts#L28-L164" }, { "kind": "response", @@ -257674,7 +257826,7 @@ "name": "SqlFormat", "namespace": "sql.query" }, - "specLocation": "sql/query/QuerySqlRequest.ts#L153-L161" + "specLocation": "sql/query/QuerySqlRequest.ts#L166-L174" }, { "kind": "request", diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index 34717a8197..99ea72ecb7 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -1,5 +1,53 @@ { "endpointErrors": { + "cat.count": { + "request": [ + "Request: query parameter 'project_routing' does not exist in the json spec" + ], + "response": [] + }, + "count": { + "request": [ + "Request: query parameter 'project_routing' does not exist in the json spec" + ], + "response": [] + }, + "eql.search": { + "request": [ + "Request: query parameter 'project_routing' does not exist in the json spec" + ], + "response": [] + }, + "msearch_template": { + "request": [ + "Request: query parameter 'project_routing' does not exist in the json spec" + ], + "response": [] + }, + "open_point_in_time": { + "request": [ + "Request: query parameter 'project_routing' does not exist in the json spec" + ], + "response": [] + }, + "search_mvt": { + "request": [ + "Request: query parameter 'project_routing' does not exist in the json spec" + ], + "response": [] + }, + "search_template": { + "request": [ + "Request: query parameter 'project_routing' does not exist in the json spec" + ], + "response": [] + }, + "sql.query": { + "request": [ + "Request: query parameter 'project_routing' does not exist in the json spec" + ], + "response": [] + }, "streams.status": { "request": [ "Request: query parameter 'master_timeout' does not exist in the json spec", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 9591f6514a..9c90d91852 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -143,6 +143,7 @@ export interface CountRequest extends RequestBase { lenient?: boolean min_score?: double preference?: string + project_routing?: ProjectRouting routing?: Routing terminate_after?: long q?: string @@ -781,6 +782,7 @@ export interface MsearchTemplateRequest extends RequestBase { index?: Indices ccs_minimize_roundtrips?: boolean max_concurrent_searches?: long + project_routing?: ProjectRouting search_type?: SearchType rest_total_hits_as_int?: boolean typed_keys?: boolean @@ -854,6 +856,7 @@ export interface OpenPointInTimeRequest extends RequestBase { keep_alive: Duration ignore_unavailable?: boolean preference?: string + project_routing?: ProjectRouting routing?: Routing expand_wildcards?: ExpandWildcards allow_partial_search_results?: boolean @@ -1860,6 +1863,7 @@ export interface SearchMvtRequest extends RequestBase { grid_agg?: SearchMvtGridAggregationType grid_precision?: integer grid_type?: SearchMvtGridType + project_routing?: ProjectRouting size?: integer track_total_hits?: SearchTrackHits with_labels?: boolean @@ -1935,6 +1939,7 @@ export interface SearchTemplateRequest extends RequestBase { ignore_unavailable?: boolean preference?: string profile?: boolean + project_routing?: ProjectRouting routing?: Routing scroll?: Duration search_type?: SearchType @@ -7405,6 +7410,7 @@ export interface CatCountCountRecord { export interface CatCountRequest extends CatCatRequestBase { index?: Indices h?: CatCatCountColumns + project_routing?: ProjectRouting s?: Names } @@ -10999,6 +11005,7 @@ export interface EqlSearchRequest extends RequestBase { ignore_unavailable?: boolean keep_alive?: Duration keep_on_completion?: boolean + project_routing?: ProjectRouting wait_for_completion_timeout?: Duration body?: { query: string @@ -21948,6 +21955,7 @@ export interface SqlGetAsyncStatusResponse { export interface SqlQueryRequest extends RequestBase { format?: SqlQuerySqlFormat + project_routing?: ProjectRouting body?: { allow_partial_search_results?: boolean catalog?: string diff --git a/specification/_global/count/CountRequest.ts b/specification/_global/count/CountRequest.ts index 921d53c246..894e9912f3 100644 --- a/specification/_global/count/CountRequest.ts +++ b/specification/_global/count/CountRequest.ts @@ -18,7 +18,12 @@ */ import { RequestBase } from '@_types/Base' -import { ExpandWildcards, Indices, ProjectRouting, Routing } from '@_types/common' +import { + ExpandWildcards, + Indices, + ProjectRouting, + Routing +} from '@_types/common' import { double, long } from '@_types/Numeric' import { QueryContainer } from '@_types/query_dsl/abstractions' import { Operator } from '@_types/query_dsl/Operator' diff --git a/specification/_global/open_point_in_time/OpenPointInTimeRequest.ts b/specification/_global/open_point_in_time/OpenPointInTimeRequest.ts index 41443534ed..c9e0d7ba51 100644 --- a/specification/_global/open_point_in_time/OpenPointInTimeRequest.ts +++ b/specification/_global/open_point_in_time/OpenPointInTimeRequest.ts @@ -18,7 +18,12 @@ */ import { RequestBase } from '@_types/Base' -import { ExpandWildcards, Indices, ProjectRouting, Routing } from '@_types/common' +import { + ExpandWildcards, + Indices, + ProjectRouting, + Routing +} from '@_types/common' import { integer } from '@_types/Numeric' import { QueryContainer } from '@_types/query_dsl/abstractions' import { Duration } from '@_types/Time' From 14167616d8fd76f5425136f245ec7672f3b9e077 Mon Sep 17 00:00:00 2001 From: Michael Peterson Date: Thu, 18 Sep 2025 16:38:20 -0400 Subject: [PATCH 3/3] Removed project routing from _json_spec as those get auto added later --- specification/_json_spec/field_caps.json | 4 ---- specification/_json_spec/indices.resolve_index.json | 4 ---- specification/_json_spec/msearch.json | 4 ---- 3 files changed, 12 deletions(-) diff --git a/specification/_json_spec/field_caps.json b/specification/_json_spec/field_caps.json index 05322eb496..51d6924021 100644 --- a/specification/_json_spec/field_caps.json +++ b/specification/_json_spec/field_caps.json @@ -64,10 +64,6 @@ "type": "boolean", "default": true, "description": "Include empty fields in result" - }, - "project_routing": { - "type": "string", - "description": "A Lucene query using project metadata tags to limit which projects to include, such as _alias:_origin or _alias:*pr*. Only supported in serverless." } }, "body": { diff --git a/specification/_json_spec/indices.resolve_index.json b/specification/_json_spec/indices.resolve_index.json index 7facc52d55..d3e23cc24b 100644 --- a/specification/_json_spec/indices.resolve_index.json +++ b/specification/_json_spec/indices.resolve_index.json @@ -45,10 +45,6 @@ "options": ["standard", "time_series", "logsdb", "lookup"], "default": "", "description": "Filter indices by index mode. Comma-separated list of IndexMode. Empty means no filter." - }, - "project_routing": { - "type": "string", - "description": "A Lucene query using project metadata tags to limit which projects to include, such as _alias:_origin or _alias:*pr*. Only supported in serverless." } } } diff --git a/specification/_json_spec/msearch.json b/specification/_json_spec/msearch.json index 4c96ce0476..2aaf0586e2 100644 --- a/specification/_json_spec/msearch.json +++ b/specification/_json_spec/msearch.json @@ -84,10 +84,6 @@ "default": "open", "description": "Whether to expand wildcard expression to concrete indices that are open, closed or both." }, - "project_routing": { - "type": "string", - "description": "A Lucene query using project metadata tags to limit which projects to search, such as _alias:_origin or _alias:*pr*. Only supported in serverless." - }, "routing": { "type": "list", "description": "A comma-separated list of specific routing values"