@@ -3058,129 +3058,186 @@ async def search(
3058
3058
3059
3059
`<https://www.elastic.co/guide/en/elasticsearch/reference/generated/search-search.html>`_
3060
3060
3061
- :param index: A comma-separated list of index names to search; use `_all` or
3062
- empty string to perform the operation on all indices
3063
- :param aggregations:
3064
- :param aggs:
3065
- :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves
3066
- into no concrete indices. (This includes `_all` string or when no indices
3067
- have been specified)
3068
- :param allow_partial_search_results: Indicate if an error should be returned
3069
- if there is a partial search failure or timeout
3070
- :param analyze_wildcard: Specify whether wildcard and prefix queries should be
3071
- analyzed (default: false)
3072
- :param analyzer: The analyzer to use for the query string
3061
+ :param index: Comma-separated list of data streams, indices, and aliases to search.
3062
+ Supports wildcards (`*`). To search all data streams and indices, omit this
3063
+ parameter or use `*` or `_all`.
3064
+ :param aggregations: Defines the aggregations that are run as part of the search
3065
+ request.
3066
+ :param aggs: Defines the aggregations that are run as part of the search request.
3067
+ :param allow_no_indices: If `false`, the request returns an error if any wildcard
3068
+ expression, index alias, or `_all` value targets only missing or closed indices.
3069
+ This behavior applies even if the request targets other open indices. For
3070
+ example, a request targeting `foo*,bar*` returns an error if an index starts
3071
+ with `foo` but no index starts with `bar`.
3072
+ :param allow_partial_search_results: If true, returns partial results if there
3073
+ are shard request timeouts or shard failures. If false, returns an error
3074
+ with no partial results.
3075
+ :param analyze_wildcard: If true, wildcard and prefix queries are analyzed. This
3076
+ parameter can only be used when the q query string parameter is specified.
3077
+ :param analyzer: Analyzer to use for the query string. This parameter can only
3078
+ be used when the q query string parameter is specified.
3073
3079
:param batched_reduce_size: The number of shard results that should be reduced
3074
3080
at once on the coordinating node. This value should be used as a protection
3075
3081
mechanism to reduce the memory overhead per search request if the potential
3076
3082
number of shards in the request can be large.
3077
- :param ccs_minimize_roundtrips: Indicates whether network round-trips should
3078
- be minimized as part of cross-cluster search requests execution
3079
- :param collapse:
3080
- :param default_operator: The default operator for query string query (AND or
3081
- OR)
3082
- :param df: The field to use as default where no field prefix is given in the
3083
- query string
3084
- :param docvalue_fields: Array of wildcard (*) patterns. The request returns doc
3085
- values for field names matching these patterns in the hits.fields property
3083
+ :param ccs_minimize_roundtrips: If true, network round-trips between the coordinating
3084
+ node and the remote clusters are minimized when executing cross-cluster search
3085
+ (CCS) requests.
3086
+ :param collapse: Collapses search results the values of the specified field.
3087
+ :param default_operator: The default operator for query string query: AND or
3088
+ OR. This parameter can only be used when the `q` query string parameter is
3089
+ specified.
3090
+ :param df: Field to use as default where no field prefix is given in the query
3091
+ string. This parameter can only be used when the q query string parameter
3092
+ is specified.
3093
+ :param docvalue_fields: Array of wildcard (`*`) patterns. The request returns
3094
+ doc values for field names matching these patterns in the `hits.fields` property
3086
3095
of the response.
3087
- :param expand_wildcards: Whether to expand wildcard expression to concrete indices
3088
- that are open, closed or both.
3096
+ :param expand_wildcards: Type of index that wildcard patterns can match. If the
3097
+ request can target data streams, this argument determines whether wildcard
3098
+ expressions match hidden data streams. Supports comma-separated values, such
3099
+ as `open,hidden`.
3089
3100
:param explain: If true, returns detailed information about score computation
3090
3101
as part of a hit.
3091
3102
:param ext: Configuration of search extensions defined by Elasticsearch plugins.
3092
- :param fields: Array of wildcard (*) patterns. The request returns values for
3093
- field names matching these patterns in the hits.fields property of the response.
3094
- :param from_: Starting document offset. By default, you cannot page through more
3095
- than 10,000 hits using the from and size parameters. To page through more
3096
- hits, use the search_after parameter.
3097
- :param highlight:
3098
- :param ignore_throttled: Whether specified concrete, expanded or aliased indices
3099
- should be ignored when throttled
3100
- :param ignore_unavailable: Whether specified concrete indices should be ignored
3101
- when unavailable (missing or closed)
3103
+ :param fields: Array of wildcard (`*`) patterns. The request returns values for
3104
+ field names matching these patterns in the `hits.fields` property of the
3105
+ response.
3106
+ :param from_: Starting document offset. Needs to be non-negative. By default,
3107
+ you cannot page through more than 10,000 hits using the `from` and `size`
3108
+ parameters. To page through more hits, use the `search_after` parameter.
3109
+ :param highlight: Specifies the highlighter to use for retrieving highlighted
3110
+ snippets from one or more fields in your search results.
3111
+ :param ignore_throttled: If `true`, concrete, expanded or aliased indices will
3112
+ be ignored when frozen.
3113
+ :param ignore_unavailable: If `false`, the request returns an error if it targets
3114
+ a missing or closed index.
3102
3115
:param indices_boost: Boosts the _score of documents from specified indices.
3103
3116
:param knn: Defines the approximate kNN search to run.
3104
- :param lenient: Specify whether format-based query failures (such as providing
3105
- text to a numeric field) should be ignored
3106
- :param max_concurrent_shard_requests: The number of concurrent shard requests
3107
- per node this search executes concurrently. This value should be used to
3108
- limit the impact of the search on the cluster in order to limit the number
3109
- of concurrent shard requests
3110
- :param min_compatible_shard_node: The minimum compatible version that all shards
3111
- involved in search should have for this request to be successful
3112
- :param min_score: Minimum _score for matching documents. Documents with a lower
3113
- _score are not included in the search results.
3117
+ :param lenient: If `true`, format-based query failures (such as providing text
3118
+ to a numeric field) in the query string will be ignored. This parameter can
3119
+ only be used when the `q` query string parameter is specified.
3120
+ :param max_concurrent_shard_requests: Defines the number of concurrent shard
3121
+ requests per node this search executes concurrently. This value should be
3122
+ used to limit the impact of the search on the cluster in order to limit the
3123
+ number of concurrent shard requests.
3124
+ :param min_compatible_shard_node: The minimum version of the node that can handle
3125
+ the request Any handling node with a lower version will fail the request.
3126
+ :param min_score: Minimum `_score` for matching documents. Documents with a lower
3127
+ `_score` are not included in the search results.
3114
3128
:param pit: Limits the search to a point in time (PIT). If you provide a PIT,
3115
- you cannot specify an <index> in the request path.
3116
- :param post_filter:
3117
- :param pre_filter_shard_size: A threshold that enforces a pre-filter roundtrip
3118
- to prefilter search shards based on query rewriting if the number of shards
3119
- the search request expands to exceeds the threshold. This filter roundtrip
3120
- can limit the number of shards significantly if for instance a shard can
3121
- not match any documents based on its rewrite method ie. if date filters are
3122
- mandatory to match but the shard bounds and the query are disjoint.
3123
- :param preference: Specify the node or shard the operation should be performed
3124
- on (default: random)
3125
- :param profile:
3126
- :param q: Query in the Lucene query string syntax
3129
+ you cannot specify an `<index>` in the request path.
3130
+ :param post_filter: Use the `post_filter` parameter to filter search results.
3131
+ The search hits are filtered after the aggregations are calculated. A post
3132
+ filter has no impact on the aggregation results.
3133
+ :param pre_filter_shard_size: Defines a threshold that enforces a pre-filter
3134
+ roundtrip to prefilter search shards based on query rewriting if the number
3135
+ of shards the search request expands to exceeds the threshold. This filter
3136
+ roundtrip can limit the number of shards significantly if for instance a
3137
+ shard can not match any documents based on its rewrite method (if date filters
3138
+ are mandatory to match but the shard bounds and the query are disjoint).
3139
+ When unspecified, the pre-filter phase is executed if any of these conditions
3140
+ is met: the request targets more than 128 shards; the request targets one
3141
+ or more read-only index; the primary sort of the query targets an indexed
3142
+ field.
3143
+ :param preference: Nodes and shards used for the search. By default, Elasticsearch
3144
+ selects from eligible nodes and shards using adaptive replica selection,
3145
+ accounting for allocation awareness. Valid values are: `_only_local` to run
3146
+ the search only on shards on the local node; `_local` to, if possible, run
3147
+ the search on shards on the local node, or if not, select shards using the
3148
+ default method; `_only_nodes:<node-id>,<node-id>` to run the search on only
3149
+ the specified nodes IDs, where, if suitable shards exist on more than one
3150
+ selected node, use shards on those nodes using the default method, or if
3151
+ none of the specified nodes are available, select shards from any available
3152
+ node using the default method; `_prefer_nodes:<node-id>,<node-id>` to if
3153
+ possible, run the search on the specified nodes IDs, or if not, select shards
3154
+ using the default method; `_shards:<shard>,<shard>` to run the search only
3155
+ on the specified shards; `<custom-string>` (any string that does not start
3156
+ with `_`) to route searches with the same `<custom-string>` to the same shards
3157
+ in the same order.
3158
+ :param profile: Set to `true` to return detailed timing information about the
3159
+ execution of individual components in a search request. NOTE: This is a debugging
3160
+ tool and adds significant overhead to search execution.
3161
+ :param q: Query in the Lucene query string syntax using query parameter search.
3162
+ Query parameter searches do not support the full Elasticsearch Query DSL
3163
+ but are handy for testing.
3127
3164
:param query: Defines the search definition using the Query DSL.
3128
- :param rank: Defines the Reciprocal Rank Fusion (RRF) to use
3129
- :param request_cache: Specify if request cache should be used for this request
3130
- or not, defaults to index level setting
3131
- :param rescore:
3132
- :param rest_total_hits_as_int: Indicates whether hits.total should be rendered
3133
- as an integer or an object in the rest search response
3134
- :param routing: A comma-separated list of specific routing values
3165
+ :param rank: Defines the Reciprocal Rank Fusion (RRF) to use.
3166
+ :param request_cache: If `true`, the caching of search results is enabled for
3167
+ requests where `size` is `0`. Defaults to index level settings.
3168
+ :param rescore: Can be used to improve precision by reordering just the top (for
3169
+ example 100 - 500) documents returned by the `query` and `post_filter` phases.
3170
+ :param rest_total_hits_as_int: Indicates whether `hits.total` should be rendered
3171
+ as an integer or an object in the rest search response.
3172
+ :param routing: Custom value used to route operations to a specific shard.
3135
3173
:param runtime_mappings: Defines one or more runtime fields in the search request.
3136
3174
These fields take precedence over mapped fields with the same name.
3137
3175
:param script_fields: Retrieve a script evaluation (based on different fields)
3138
3176
for each hit.
3139
- :param scroll: Specify how long a consistent view of the index should be maintained
3140
- for scrolled search
3141
- :param search_after:
3142
- :param search_type: Search operation type
3143
- :param seq_no_primary_term: If true, returns sequence number and primary term
3144
- of the last modification of each hit. See Optimistic concurrency control.
3177
+ :param scroll: Period to retain the search context for scrolling. See Scroll
3178
+ search results. By default, this value cannot exceed `1d` (24 hours). You
3179
+ can change this limit using the `search.max_keep_alive` cluster-level setting.
3180
+ :param search_after: Used to retrieve the next page of hits using a set of sort
3181
+ values from the previous page.
3182
+ :param search_type: How distributed term frequencies are calculated for relevance
3183
+ scoring.
3184
+ :param seq_no_primary_term: If `true`, returns sequence number and primary term
3185
+ of the last modification of each hit.
3145
3186
:param size: The number of hits to return. By default, you cannot page through
3146
- more than 10,000 hits using the from and size parameters. To page through
3147
- more hits, use the search_after parameter.
3148
- :param slice:
3149
- :param sort:
3187
+ more than 10,000 hits using the `from` and `size` parameters. To page through
3188
+ more hits, use the `search_after` parameter.
3189
+ :param slice: Can be used to split a scrolled search into multiple slices that
3190
+ can be consumed independently.
3191
+ :param sort: A comma-separated list of <field>:<direction> pairs.
3150
3192
:param source: Indicates which source fields are returned for matching documents.
3151
3193
These fields are returned in the hits._source property of the search response.
3152
- :param source_excludes: A list of fields to exclude from the returned _source
3153
- field
3154
- :param source_includes: A list of fields to extract and return from the _source
3155
- field
3194
+ :param source_excludes: A comma-separated list of source fields to exclude from
3195
+ the response. You can also use this parameter to exclude fields from the
3196
+ subset specified in `_source_includes` query parameter. If the `_source`
3197
+ parameter is `false`, this parameter is ignored.
3198
+ :param source_includes: A comma-separated list of source fields to include in
3199
+ the response. If this parameter is specified, only these source fields are
3200
+ returned. You can exclude fields from this subset using the `_source_excludes`
3201
+ query parameter. If the `_source` parameter is `false`, this parameter is
3202
+ ignored.
3156
3203
:param stats: Stats groups to associate with the search. Each group maintains
3157
3204
a statistics aggregation for its associated searches. You can retrieve these
3158
3205
stats using the indices stats API.
3159
3206
:param stored_fields: List of stored fields to return as part of a hit. If no
3160
3207
fields are specified, no stored fields are included in the response. If this
3161
- field is specified, the _source parameter defaults to false. You can pass
3162
- _source: true to return both source fields and stored fields in the search
3163
- response.
3164
- :param suggest:
3208
+ field is specified, the `_source` parameter defaults to `false`. You can
3209
+ pass `_source: true` to return both source fields and stored fields in the
3210
+ search response.
3211
+ :param suggest: Defines a suggester that provides similar looking terms based
3212
+ on a provided text.
3165
3213
:param suggest_field: Specifies which field to use for suggestions.
3166
- :param suggest_mode: Specify suggest mode
3167
- :param suggest_size: How many suggestions to return in response
3214
+ :param suggest_mode: Specifies the suggest mode. This parameter can only be used
3215
+ when the `suggest_field` and `suggest_text` query string parameters are specified.
3216
+ :param suggest_size: Number of suggestions to return. This parameter can only
3217
+ be used when the `suggest_field` and `suggest_text` query string parameters
3218
+ are specified.
3168
3219
:param suggest_text: The source text for which the suggestions should be returned.
3220
+ This parameter can only be used when the `suggest_field` and `suggest_text`
3221
+ query string parameters are specified.
3169
3222
:param terminate_after: Maximum number of documents to collect for each shard.
3170
3223
If a query reaches this limit, Elasticsearch terminates the query early.
3171
- Elasticsearch collects documents before sorting. Defaults to 0, which does
3172
- not terminate query execution early.
3224
+ Elasticsearch collects documents before sorting. Use with caution. Elasticsearch
3225
+ applies this parameter to each shard handling the request. When possible,
3226
+ let Elasticsearch perform early termination automatically. Avoid specifying
3227
+ this parameter for requests that target data streams with backing indices
3228
+ across multiple data tiers. If set to `0` (default), the query does not terminate
3229
+ early.
3173
3230
:param timeout: Specifies the period of time to wait for a response from each
3174
3231
shard. If no response is received before the timeout expires, the request
3175
3232
fails and returns an error. Defaults to no timeout.
3176
3233
:param track_scores: If true, calculate and return document scores, even if the
3177
3234
scores are not used for sorting.
3178
3235
:param track_total_hits: Number of hits matching the query to count accurately.
3179
- If true, the exact number of hits is returned at the cost of some performance.
3180
- If false, the response does not include the total number of hits matching
3181
- the query. Defaults to 10,000 hits.
3182
- :param typed_keys: Specify whether aggregation and suggester names should be
3183
- prefixed by their respective types in the response
3236
+ If ` true` , the exact number of hits is returned at the cost of some performance.
3237
+ If ` false` , the response does not include the total number of hits matching
3238
+ the query.
3239
+ :param typed_keys: If `true`, aggregation and suggester names are be prefixed
3240
+ by their respective types in the response.
3184
3241
:param version: If true, returns document version as part of a hit.
3185
3242
"""
3186
3243
if index not in SKIP_IN_PATH :
0 commit comments