From 33395baff8df02710fffac87f577607cb7a49436 Mon Sep 17 00:00:00 2001 From: dblock Date: Fri, 21 Jun 2024 09:03:01 -0400 Subject: [PATCH] Added support for cancel_after_time_interval and phase_took in _search. Signed-off-by: dblock --- spec/namespaces/_core.yaml | 177 +++++++++++++++++++-------------- spec/schemas/_common.yaml | 22 ++++ spec/schemas/_core.search.yaml | 2 + tests/_core/search.yaml | 9 ++ 4 files changed, 134 insertions(+), 76 deletions(-) diff --git a/spec/namespaces/_core.yaml b/spec/namespaces/_core.yaml index a2c35ef50..67f812107 100644 --- a/spec/namespaces/_core.yaml +++ b/spec/namespaces/_core.yaml @@ -643,50 +643,52 @@ paths: externalDocs: url: https://opensearch.org/docs/latest/api-reference/search/ parameters: - - $ref: '#/components/parameters/search::query.analyzer' + - $ref: '#/components/parameters/search::query._source_excludes' + - $ref: '#/components/parameters/search::query._source_includes' + - $ref: '#/components/parameters/search::query._source' + - $ref: '#/components/parameters/search::query.allow_no_indices' + - $ref: '#/components/parameters/search::query.allow_partial_search_results' - $ref: '#/components/parameters/search::query.analyze_wildcard' + - $ref: '#/components/parameters/search::query.analyzer' + - $ref: '#/components/parameters/search::query.batched_reduce_size' + - $ref: '#/components/parameters/search::query.cancel_after_time_interval' - $ref: '#/components/parameters/search::query.ccs_minimize_roundtrips' - $ref: '#/components/parameters/search::query.default_operator' - $ref: '#/components/parameters/search::query.df' - - $ref: '#/components/parameters/search::query.explain' - - $ref: '#/components/parameters/search::query.stored_fields' - $ref: '#/components/parameters/search::query.docvalue_fields' + - $ref: '#/components/parameters/search::query.expand_wildcards' + - $ref: '#/components/parameters/search::query.explain' - $ref: '#/components/parameters/search::query.from' - - $ref: '#/components/parameters/search::query.ignore_unavailable' - $ref: '#/components/parameters/search::query.ignore_throttled' - - $ref: '#/components/parameters/search::query.allow_no_indices' - - $ref: '#/components/parameters/search::query.expand_wildcards' + - $ref: '#/components/parameters/search::query.ignore_unavailable' + - $ref: '#/components/parameters/search::query.include_named_queries_score' - $ref: '#/components/parameters/search::query.lenient' + - $ref: '#/components/parameters/search::query.max_concurrent_shard_requests' + - $ref: '#/components/parameters/search::query.phase_took' + - $ref: '#/components/parameters/search::query.pre_filter_shard_size' - $ref: '#/components/parameters/search::query.preference' - $ref: '#/components/parameters/search::query.q' + - $ref: '#/components/parameters/search::query.request_cache' + - $ref: '#/components/parameters/search::query.rest_total_hits_as_int' - $ref: '#/components/parameters/search::query.routing' - $ref: '#/components/parameters/search::query.scroll' + - $ref: '#/components/parameters/search::query.search_pipeline' - $ref: '#/components/parameters/search::query.search_type' + - $ref: '#/components/parameters/search::query.seq_no_primary_term' - $ref: '#/components/parameters/search::query.size' - $ref: '#/components/parameters/search::query.sort' - - $ref: '#/components/parameters/search::query._source' - - $ref: '#/components/parameters/search::query._source_excludes' - - $ref: '#/components/parameters/search::query._source_includes' - - $ref: '#/components/parameters/search::query.terminate_after' - $ref: '#/components/parameters/search::query.stats' + - $ref: '#/components/parameters/search::query.stored_fields' - $ref: '#/components/parameters/search::query.suggest_field' - $ref: '#/components/parameters/search::query.suggest_mode' - $ref: '#/components/parameters/search::query.suggest_size' - $ref: '#/components/parameters/search::query.suggest_text' + - $ref: '#/components/parameters/search::query.terminate_after' - $ref: '#/components/parameters/search::query.timeout' - $ref: '#/components/parameters/search::query.track_scores' - $ref: '#/components/parameters/search::query.track_total_hits' - - $ref: '#/components/parameters/search::query.allow_partial_search_results' - $ref: '#/components/parameters/search::query.typed_keys' - $ref: '#/components/parameters/search::query.version' - - $ref: '#/components/parameters/search::query.seq_no_primary_term' - - $ref: '#/components/parameters/search::query.request_cache' - - $ref: '#/components/parameters/search::query.batched_reduce_size' - - $ref: '#/components/parameters/search::query.max_concurrent_shard_requests' - - $ref: '#/components/parameters/search::query.pre_filter_shard_size' - - $ref: '#/components/parameters/search::query.rest_total_hits_as_int' - - $ref: '#/components/parameters/search::query.search_pipeline' - - $ref: '#/components/parameters/search::query.include_named_queries_score' requestBody: $ref: '#/components/requestBodies/search' responses: @@ -700,50 +702,52 @@ paths: externalDocs: url: https://opensearch.org/docs/latest/api-reference/search/ parameters: - - $ref: '#/components/parameters/search::query.analyzer' + - $ref: '#/components/parameters/search::query._source_excludes' + - $ref: '#/components/parameters/search::query._source_includes' + - $ref: '#/components/parameters/search::query._source' + - $ref: '#/components/parameters/search::query.allow_no_indices' + - $ref: '#/components/parameters/search::query.allow_partial_search_results' - $ref: '#/components/parameters/search::query.analyze_wildcard' + - $ref: '#/components/parameters/search::query.analyzer' + - $ref: '#/components/parameters/search::query.batched_reduce_size' + - $ref: '#/components/parameters/search::query.cancel_after_time_interval' - $ref: '#/components/parameters/search::query.ccs_minimize_roundtrips' - $ref: '#/components/parameters/search::query.default_operator' - $ref: '#/components/parameters/search::query.df' - - $ref: '#/components/parameters/search::query.explain' - - $ref: '#/components/parameters/search::query.stored_fields' - $ref: '#/components/parameters/search::query.docvalue_fields' + - $ref: '#/components/parameters/search::query.expand_wildcards' + - $ref: '#/components/parameters/search::query.explain' - $ref: '#/components/parameters/search::query.from' - - $ref: '#/components/parameters/search::query.ignore_unavailable' - $ref: '#/components/parameters/search::query.ignore_throttled' - - $ref: '#/components/parameters/search::query.allow_no_indices' - - $ref: '#/components/parameters/search::query.expand_wildcards' + - $ref: '#/components/parameters/search::query.ignore_unavailable' + - $ref: '#/components/parameters/search::query.include_named_queries_score' - $ref: '#/components/parameters/search::query.lenient' + - $ref: '#/components/parameters/search::query.max_concurrent_shard_requests' + - $ref: '#/components/parameters/search::query.phase_took' + - $ref: '#/components/parameters/search::query.pre_filter_shard_size' - $ref: '#/components/parameters/search::query.preference' - $ref: '#/components/parameters/search::query.q' + - $ref: '#/components/parameters/search::query.request_cache' + - $ref: '#/components/parameters/search::query.rest_total_hits_as_int' - $ref: '#/components/parameters/search::query.routing' - $ref: '#/components/parameters/search::query.scroll' + - $ref: '#/components/parameters/search::query.search_pipeline' - $ref: '#/components/parameters/search::query.search_type' + - $ref: '#/components/parameters/search::query.seq_no_primary_term' - $ref: '#/components/parameters/search::query.size' - $ref: '#/components/parameters/search::query.sort' - - $ref: '#/components/parameters/search::query._source' - - $ref: '#/components/parameters/search::query._source_excludes' - - $ref: '#/components/parameters/search::query._source_includes' - - $ref: '#/components/parameters/search::query.terminate_after' - $ref: '#/components/parameters/search::query.stats' + - $ref: '#/components/parameters/search::query.stored_fields' - $ref: '#/components/parameters/search::query.suggest_field' - $ref: '#/components/parameters/search::query.suggest_mode' - $ref: '#/components/parameters/search::query.suggest_size' - $ref: '#/components/parameters/search::query.suggest_text' + - $ref: '#/components/parameters/search::query.terminate_after' - $ref: '#/components/parameters/search::query.timeout' - $ref: '#/components/parameters/search::query.track_scores' - $ref: '#/components/parameters/search::query.track_total_hits' - - $ref: '#/components/parameters/search::query.allow_partial_search_results' - $ref: '#/components/parameters/search::query.typed_keys' - $ref: '#/components/parameters/search::query.version' - - $ref: '#/components/parameters/search::query.seq_no_primary_term' - - $ref: '#/components/parameters/search::query.request_cache' - - $ref: '#/components/parameters/search::query.batched_reduce_size' - - $ref: '#/components/parameters/search::query.max_concurrent_shard_requests' - - $ref: '#/components/parameters/search::query.pre_filter_shard_size' - - $ref: '#/components/parameters/search::query.rest_total_hits_as_int' - - $ref: '#/components/parameters/search::query.search_pipeline' - - $ref: '#/components/parameters/search::query.include_named_queries_score' requestBody: $ref: '#/components/requestBodies/search' responses: @@ -1667,50 +1671,52 @@ paths: url: https://opensearch.org/docs/latest/api-reference/search/ parameters: - $ref: '#/components/parameters/search::path.index' - - $ref: '#/components/parameters/search::query.analyzer' + - $ref: '#/components/parameters/search::query._source_excludes' + - $ref: '#/components/parameters/search::query._source_includes' + - $ref: '#/components/parameters/search::query._source' + - $ref: '#/components/parameters/search::query.allow_no_indices' + - $ref: '#/components/parameters/search::query.allow_partial_search_results' - $ref: '#/components/parameters/search::query.analyze_wildcard' + - $ref: '#/components/parameters/search::query.analyzer' + - $ref: '#/components/parameters/search::query.batched_reduce_size' + - $ref: '#/components/parameters/search::query.cancel_after_time_interval' - $ref: '#/components/parameters/search::query.ccs_minimize_roundtrips' - $ref: '#/components/parameters/search::query.default_operator' - $ref: '#/components/parameters/search::query.df' - - $ref: '#/components/parameters/search::query.explain' - - $ref: '#/components/parameters/search::query.stored_fields' - $ref: '#/components/parameters/search::query.docvalue_fields' + - $ref: '#/components/parameters/search::query.expand_wildcards' + - $ref: '#/components/parameters/search::query.explain' - $ref: '#/components/parameters/search::query.from' - - $ref: '#/components/parameters/search::query.ignore_unavailable' - $ref: '#/components/parameters/search::query.ignore_throttled' - - $ref: '#/components/parameters/search::query.allow_no_indices' - - $ref: '#/components/parameters/search::query.expand_wildcards' + - $ref: '#/components/parameters/search::query.ignore_unavailable' + - $ref: '#/components/parameters/search::query.include_named_queries_score' - $ref: '#/components/parameters/search::query.lenient' + - $ref: '#/components/parameters/search::query.max_concurrent_shard_requests' + - $ref: '#/components/parameters/search::query.phase_took' + - $ref: '#/components/parameters/search::query.pre_filter_shard_size' - $ref: '#/components/parameters/search::query.preference' - $ref: '#/components/parameters/search::query.q' + - $ref: '#/components/parameters/search::query.request_cache' + - $ref: '#/components/parameters/search::query.rest_total_hits_as_int' - $ref: '#/components/parameters/search::query.routing' - $ref: '#/components/parameters/search::query.scroll' + - $ref: '#/components/parameters/search::query.search_pipeline' - $ref: '#/components/parameters/search::query.search_type' + - $ref: '#/components/parameters/search::query.seq_no_primary_term' - $ref: '#/components/parameters/search::query.size' - $ref: '#/components/parameters/search::query.sort' - - $ref: '#/components/parameters/search::query._source' - - $ref: '#/components/parameters/search::query._source_excludes' - - $ref: '#/components/parameters/search::query._source_includes' - - $ref: '#/components/parameters/search::query.terminate_after' - $ref: '#/components/parameters/search::query.stats' + - $ref: '#/components/parameters/search::query.stored_fields' - $ref: '#/components/parameters/search::query.suggest_field' - $ref: '#/components/parameters/search::query.suggest_mode' - $ref: '#/components/parameters/search::query.suggest_size' - $ref: '#/components/parameters/search::query.suggest_text' + - $ref: '#/components/parameters/search::query.terminate_after' - $ref: '#/components/parameters/search::query.timeout' - $ref: '#/components/parameters/search::query.track_scores' - $ref: '#/components/parameters/search::query.track_total_hits' - - $ref: '#/components/parameters/search::query.allow_partial_search_results' - $ref: '#/components/parameters/search::query.typed_keys' - $ref: '#/components/parameters/search::query.version' - - $ref: '#/components/parameters/search::query.seq_no_primary_term' - - $ref: '#/components/parameters/search::query.request_cache' - - $ref: '#/components/parameters/search::query.batched_reduce_size' - - $ref: '#/components/parameters/search::query.max_concurrent_shard_requests' - - $ref: '#/components/parameters/search::query.pre_filter_shard_size' - - $ref: '#/components/parameters/search::query.rest_total_hits_as_int' - - $ref: '#/components/parameters/search::query.search_pipeline' - - $ref: '#/components/parameters/search::query.include_named_queries_score' requestBody: $ref: '#/components/requestBodies/search' responses: @@ -1725,50 +1731,52 @@ paths: url: https://opensearch.org/docs/latest/api-reference/search/ parameters: - $ref: '#/components/parameters/search::path.index' - - $ref: '#/components/parameters/search::query.analyzer' + - $ref: '#/components/parameters/search::query._source_excludes' + - $ref: '#/components/parameters/search::query._source_includes' + - $ref: '#/components/parameters/search::query._source' + - $ref: '#/components/parameters/search::query.allow_no_indices' + - $ref: '#/components/parameters/search::query.allow_partial_search_results' - $ref: '#/components/parameters/search::query.analyze_wildcard' + - $ref: '#/components/parameters/search::query.analyzer' + - $ref: '#/components/parameters/search::query.batched_reduce_size' + - $ref: '#/components/parameters/search::query.cancel_after_time_interval' - $ref: '#/components/parameters/search::query.ccs_minimize_roundtrips' - $ref: '#/components/parameters/search::query.default_operator' - $ref: '#/components/parameters/search::query.df' - - $ref: '#/components/parameters/search::query.explain' - - $ref: '#/components/parameters/search::query.stored_fields' - $ref: '#/components/parameters/search::query.docvalue_fields' + - $ref: '#/components/parameters/search::query.expand_wildcards' + - $ref: '#/components/parameters/search::query.explain' - $ref: '#/components/parameters/search::query.from' - - $ref: '#/components/parameters/search::query.ignore_unavailable' - $ref: '#/components/parameters/search::query.ignore_throttled' - - $ref: '#/components/parameters/search::query.allow_no_indices' - - $ref: '#/components/parameters/search::query.expand_wildcards' + - $ref: '#/components/parameters/search::query.ignore_unavailable' + - $ref: '#/components/parameters/search::query.include_named_queries_score' - $ref: '#/components/parameters/search::query.lenient' + - $ref: '#/components/parameters/search::query.max_concurrent_shard_requests' + - $ref: '#/components/parameters/search::query.phase_took' + - $ref: '#/components/parameters/search::query.pre_filter_shard_size' - $ref: '#/components/parameters/search::query.preference' - $ref: '#/components/parameters/search::query.q' + - $ref: '#/components/parameters/search::query.request_cache' + - $ref: '#/components/parameters/search::query.rest_total_hits_as_int' - $ref: '#/components/parameters/search::query.routing' - $ref: '#/components/parameters/search::query.scroll' + - $ref: '#/components/parameters/search::query.search_pipeline' - $ref: '#/components/parameters/search::query.search_type' + - $ref: '#/components/parameters/search::query.seq_no_primary_term' - $ref: '#/components/parameters/search::query.size' - $ref: '#/components/parameters/search::query.sort' - - $ref: '#/components/parameters/search::query._source' - - $ref: '#/components/parameters/search::query._source_excludes' - - $ref: '#/components/parameters/search::query._source_includes' - - $ref: '#/components/parameters/search::query.terminate_after' - $ref: '#/components/parameters/search::query.stats' + - $ref: '#/components/parameters/search::query.stored_fields' - $ref: '#/components/parameters/search::query.suggest_field' - $ref: '#/components/parameters/search::query.suggest_mode' - $ref: '#/components/parameters/search::query.suggest_size' - $ref: '#/components/parameters/search::query.suggest_text' + - $ref: '#/components/parameters/search::query.terminate_after' - $ref: '#/components/parameters/search::query.timeout' - $ref: '#/components/parameters/search::query.track_scores' - $ref: '#/components/parameters/search::query.track_total_hits' - - $ref: '#/components/parameters/search::query.allow_partial_search_results' - $ref: '#/components/parameters/search::query.typed_keys' - $ref: '#/components/parameters/search::query.version' - - $ref: '#/components/parameters/search::query.seq_no_primary_term' - - $ref: '#/components/parameters/search::query.request_cache' - - $ref: '#/components/parameters/search::query.batched_reduce_size' - - $ref: '#/components/parameters/search::query.max_concurrent_shard_requests' - - $ref: '#/components/parameters/search::query.pre_filter_shard_size' - - $ref: '#/components/parameters/search::query.rest_total_hits_as_int' - - $ref: '#/components/parameters/search::query.search_pipeline' - - $ref: '#/components/parameters/search::query.include_named_queries_score' requestBody: $ref: '#/components/requestBodies/search' responses: @@ -5405,6 +5413,15 @@ components: schema: $ref: '../schemas/_common.yaml#/components/schemas/Routing' style: form + search::query.cancel_after_time_interval: + in: query + name: cancel_after_time_interval + description: |- + The time after which the search request will be canceled. + Request-level parameter takes precedence over `cancel_after_time_interval` cluster setting. + schema: + $ref: '../schemas/_common.yaml#/components/schemas/Duration' + style: form search::query.scroll: in: query name: scroll @@ -5567,6 +5584,14 @@ components: schema: type: boolean style: form + search::query.phase_took: + name: phase_took + in: query + description: Indicates whether to return phase-level `took` time values in the response. + schema: + type: boolean + default: false + style: form search_shards::path.index: in: path name: index diff --git a/spec/schemas/_common.yaml b/spec/schemas/_common.yaml index ce7510e20..451427e29 100644 --- a/spec/schemas/_common.yaml +++ b/spec/schemas/_common.yaml @@ -1820,3 +1820,25 @@ components: - minimum_index_compatibility_version - minimum_wire_compatibility_version - number + PhaseTook: + type: object + properties: + dfs_pre_query: + $ref: '#/components/schemas/uint' + query: + $ref: '#/components/schemas/uint' + fetch: + $ref: '#/components/schemas/uint' + dfs_query: + $ref: '#/components/schemas/uint' + expand: + $ref: '#/components/schemas/uint' + can_match: + $ref: '#/components/schemas/uint' + required: + - dfs_pre_query + - query + - fetch + - dfs_query + - expand + - can_match \ No newline at end of file diff --git a/spec/schemas/_core.search.yaml b/spec/schemas/_core.search.yaml index 935fbd7ff..6e3ed1f75 100644 --- a/spec/schemas/_core.search.yaml +++ b/spec/schemas/_core.search.yaml @@ -851,6 +851,8 @@ components: type: boolean _shards: $ref: '_common.yaml#/components/schemas/ShardStatistics' + phase_took: + $ref: '_common.yaml#/components/schemas/PhaseTook' hits: $ref: '#/components/schemas/HitsMetadata' aggregations: diff --git a/tests/_core/search.yaml b/tests/_core/search.yaml index aab05f01a..16668e20c 100644 --- a/tests/_core/search.yaml +++ b/tests/_core/search.yaml @@ -87,3 +87,12 @@ chapters: director: Bennett Miller title: Moneyball year: 2011 + - synopsis: Search with parameters. + path: /{index}/_search + parameters: + index: movies + cancel_after_time_interval: 10s + phase_took: true + method: POST + response: + status: 200