---
type: api
title: Run an async search
description: **All methods and paths for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/operation/operation-async-search-submit
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/operation/operation-async-search-submit
products:
  - Elasticsearch Serverless
---

# Run an async search


Availability:

## Paths

- `POST` `/{index}/_async_search`
- `POST` `/_async_search`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/authentication#apikeyauth)

#### Path Parameters

- `index` (union IndexName | [] IndexName) — optional, leave it out to use `/_async_search`
  A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices

## Description

When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested.

Warning: Asynchronous search does not support scroll or search requests that include only the suggest section.

By default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error.
The maximum allowed size for a stored async search response can be set by changing the `search.max_async_search_response_size` cluster level setting.

## Query String Parameters

- `wait_for_completion_timeout` (string Duration · default: 1s)
  Blocks and waits until the search is completed up to a certain timeout.
When the async search completes within the timeout, the response won’t include the ID as the results are not stored in the cluster.
- `keep_alive` (string Duration · default: 5d)
  Specifies how long the async search needs to be available.
Ongoing async searches and any saved search results are deleted after this period.
- `keep_on_completion` (boolean · default: false)
  If `true`, results are stored for later retrieval when the search completes within the `wait_for_completion_timeout`.
- `allow_no_indices` (boolean)
  A setting that does two separate checks on the index expression.
If `false`, the request returns an error (1) if any wildcard expression
(including `_all` and `*`) resolves to zero matching indices or (2) if the
complete set of resolved indices, aliases or data streams is empty after all
expressions are evaluated. If `true`, index expressions that resolve to no
indices are allowed and the request returns an empty result.
- `allow_partial_search_results` (boolean · default: true)
  Indicate if an error should be returned if there is a partial search failure or timeout
- `analyzer` (string)
  The analyzer to use for the query string
- `analyze_wildcard` (boolean · default: false)
  Specify whether wildcard and prefix queries should be analyzed
- `batched_reduce_size` (number · default: 5)
  Affects how often partial results become available, which happens whenever shard results are reduced.
A partial reduction is performed every time the coordinating node has received a certain number of new shard responses (5 by default).
- `ccs_minimize_roundtrips` (boolean · default: false)
  The default value is the only supported value.
- `default_operator` (enum Operator · default: or)
  The default operator for query string query (AND or OR)
  Values: `and`, `AND`, `or`, `OR`
- `df` (string)
  The field to use as default where no field prefix is given in the query string
- `docvalue_fields` (union Fields)
  A comma-separated list of fields to return as the docvalue representation of a field for each hit
  One of: `Field` or `Field[]`
- `expand_wildcards` (string ExpandWildcards · default: open)
  Whether to expand wildcard expression to concrete indices that are open, closed or both

Supported values include:
  - `all`: Match any data stream or index, including hidden ones.
  - `open`: Match open, non-hidden indices. Also matches any non-hidden data stream.
  - `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.
  - `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or `both`.
  - `none`: Wildcard expressions are not accepted.
  Values: `all`, `open`, `closed`, `hidden`, `none`
- `explain` (boolean)
  Specify whether to return detailed information about score computation as part of a hit
- `ignore_throttled` (boolean)
  Whether specified concrete, expanded or aliased indices should be ignored when throttled
- `ignore_unavailable` (boolean)
  If `false`, the request returns an error if it targets a concrete (non-wildcarded)
index, alias, or data stream that is missing, closed, or otherwise unavailable.
If `true`, unavailable concrete targets are silently ignored.
- `lenient` (boolean)
  Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
- `max_concurrent_shard_requests` (number · default: 5)
  The number of concurrent shard requests per node this search executes concurrently.
This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests
- `preference` (string · default: random)
  Specify the node or shard the operation should be performed on
- `request_cache` (boolean · default: true)
  Specify if request cache should be used for this request or not, defaults to true
- `routing` (union Routing)
  A comma-separated list of specific routing values
  One of: `string` or `string[]`
- `search_type` (enum SearchType)
  Search operation type

Supported values include:
  - `query_then_fetch`: Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate.
  - `dfs_query_then_fetch`: Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate.
  Values: `query_then_fetch`, `dfs_query_then_fetch`
- `stats` ([] string)
  Specific 'tag' of the request for logging and statistical purposes
- `stored_fields` (union Fields)
  A comma-separated list of stored fields to return as part of a hit
  One of: `Field` or `Field[]`
- `suggest_field` (string Field)
  Specifies which field to use for suggestions.
- `suggest_mode` (enum SuggestMode · default: missing)
  Specify suggest mode

Supported values include:
  - `missing`: Only generate suggestions for terms that are not in the shard.
  - `popular`: Only suggest terms that occur in more docs on the shard than the original term.
  - `always`: Suggest any matching suggestions based on terms in the suggest text.
  Values: `missing`, `popular`, `always`
- `suggest_size` (number)
  How many suggestions to return in response
- `suggest_text` (string)
  The source text for which the suggestions should be returned.
- `terminate_after` (number)
  The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early
- `timeout` (string Duration)
  Explicit operation timeout
- `track_total_hits` (boolean | number)
  Indicate if the number of documents that match the query should be tracked.
A number can also be specified, to accurately track the total hit count up to the number.
- `track_scores` (boolean)
  Whether to calculate and return scores even if they are not used for sorting
- `typed_keys` (boolean)
  Specify whether aggregation and suggester names should be prefixed by their respective types in the response
- `rest_total_hits_as_int` (boolean · default: false)
  Indicates whether hits.total should be rendered as an integer or an object in the rest search response
- `version` (boolean)
  Specify whether to return document version as part of a hit
- `_source` (union SourceConfigParam)
  True or false to return the _source field or not, or a list of fields to return
  One of: `boolean` or `Fields`
- `_source_excludes` (union Fields)
  A list of fields to exclude from the returned _source field
  One of: `Field` or `Field[]`
- `_source_includes` (union Fields)
  A list of fields to extract and return from the _source field
  One of: `Field` or `Field[]`
- `seq_no_primary_term` (boolean)
  Specify whether to return sequence number and primary term of the last modification of each hit
- `q` (string)
  Query in the Lucene query string syntax
- `size` (number · default: 10)
  Number of hits to return
- `from` (number · default: 0)
  Starting offset
- `sort` (union string | [] string)
  A comma-separated list of <field>:<direction> pairs
  One of: `string` or `string[]`

## Request Body

`application/json`

- `aggregations` (map string to {} AggregationContainer) — optional
  See [AggregationContainer](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-aggregations-aggregationcontainer)
- `collapse` ({} FieldCollapse) — optional
  - `field` (string Field) — required
    The field to collapse the result set on
  - `inner_hits` (union oneOf) — optional
    The number of inner hits and their sort order
    `InnerHits` or `InnerHits[]`
    - `name` (string Name) — optional
      The name for the particular inner hit definition in the response.
Useful when a search request contains multiple inner hits.
    - `size` (number · default: 3) — optional
      The maximum number of hits to return per `inner_hits`.
    - `from` (number · default: 0) — optional
      Inner hit starting document offset.
    - `collapse` ({} FieldCollapse) — optional — recursive
      Same fields as `collapse`
    - `docvalue_fields` ([] FieldAndFormat) — optional
      - `field` (string Field) — required
        A wildcard pattern. The request returns values for field names matching this pattern.
      - `format` (string) — optional
        The format in which the values are returned.
      - `include_unmapped` (boolean) — optional
    - `explain` (boolean) — optional
    - `highlight` ({} Highlight) — optional
      - `type` (HighlighterType) — optional
        

Supported values include:
  - `plain`: The `plain` highlighter uses the standard Lucene highlighter
  - `fvh`: The fvh highlighter uses the Lucene Fast Vector highlighter.
  - `unified`: The unified highlighter uses the Lucene Unified Highlighter.
        Values: `plain`, `fvh`, `unified`
      - `boundary_chars` (string · default: .,!? \t\n) — optional
        A string that contains each boundary character.
      - `boundary_max_scan` (number · default: 20) — optional
        How far to scan for boundary characters.
      - `boundary_scanner` (enum BoundaryScanner) — optional
        Specifies how to break the highlighted fragments: chars, sentence, or word.
Only valid for the unified and fvh highlighters.
Defaults to `sentence` for the `unified` highlighter. Defaults to `chars` for the `fvh` highlighter.

Supported values include:
  - `chars`: Use the characters specified by `boundary_chars` as highlighting boundaries.
The `boundary_max_scan` setting controls how far to scan for boundary characters.
Only valid for the `fvh` highlighter.
  - `sentence`: Break highlighted fragments at the next sentence boundary, as determined by Java’s `BreakIterator`.
You can specify the locale to use with `boundary_scanner_locale`.
When used with the `unified` highlighter, the `sentence` scanner splits sentences bigger than `fragment_size` at the first word boundary next to fragment_size.
You can set `fragment_size` to `0` to never split any sentence.
  - `word`: Break highlighted fragments at the next word boundary, as determined by Java’s `BreakIterator`.
You can specify the locale to use with `boundary_scanner_locale`.
        Values: `chars`, `sentence`, `word`
      - `boundary_scanner_locale` (string · default: Locale.ROOT) — optional
        Controls which locale is used to search for sentence and word boundaries.
This parameter takes a form of a language tag, for example: `"en-US"`, `"fr-FR"`, `"ja-JP"`.
      - `force_source` (boolean) — optional — deprecated
      - `fragmenter` (enum HighlighterFragmenter · default: span) — optional
        Specifies how text should be broken up in highlight snippets: `simple` or `span`.
Only valid for the `plain` highlighter.
        Values: `simple`, `span`
      - `fragment_size` (number · default: 100) — optional
        The size of the highlighted fragment in characters.
      - `highlight_filter` (boolean) — optional
      - `highlight_query` ({} QueryContainer) — optional
        Highlight matches for a query other than the search query.
This is especially useful if you use a rescore query because those are not taken into account by highlighting by default.
        See [QueryContainer](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
      - `max_fragment_length` (number) — optional
      - `max_analyzed_offset` (number) — optional
        If set to a non-negative value, highlighting stops at this defined maximum limit.
The rest of the text is not processed, thus not highlighted and no error is returned
The `max_analyzed_offset` query setting does not override the `index.highlight.max_analyzed_offset` setting, which prevails when it’s set to lower value than the query setting.
      - `no_match_size` (number · default: 0) — optional
        The amount of text you want to return from the beginning of the field if there are no matching fragments to highlight.
      - `number_of_fragments` (number · default: 5) — optional
        The maximum number of fragments to return.
If the number of fragments is set to `0`, no fragments are returned.
Instead, the entire field contents are highlighted and returned.
This can be handy when you need to highlight short texts such as a title or address, but fragmentation is not required.
If `number_of_fragments` is `0`, `fragment_size` is ignored.
      - `options` (map string to object) — optional
      - `order` (enum HighlighterOrder · default: none) — optional
        Sorts highlighted fragments by score when set to `score`.
By default, fragments will be output in the order they appear in the field (order: `none`).
Setting this option to `score` will output the most relevant fragments first.
Each highlighter applies its own logic to compute relevancy scores.
        Values: `score`
      - `phrase_limit` (number · default: 256) — optional
        Controls the number of matching phrases in a document that are considered.
Prevents the `fvh` highlighter from analyzing too many phrases and consuming too much memory.
When using `matched_fields`, `phrase_limit` phrases per matched field are considered. Raising the limit increases query time and consumes more memory.
Only supported by the `fvh` highlighter.
      - `post_tags` ([] string) — optional
        Use in conjunction with `pre_tags` to define the HTML tags to use for the highlighted text.
By default, highlighted text is wrapped in `<em>` and `</em>` tags.
      - `pre_tags` ([] string) — optional
        Use in conjunction with `post_tags` to define the HTML tags to use for the highlighted text.
By default, highlighted text is wrapped in `<em>` and `</em>` tags.
      - `require_field_match` (boolean · default: true) — optional
        By default, only fields that contains a query match are highlighted.
Set to `false` to highlight all fields.
      - `tags_schema` (enum HighlighterTagsSchema) — optional
        Set to `styled` to use the built-in tag schema.
        Values: `styled`
      - `encoder` (enum HighlighterEncoder) — optional
        Values: `default`, `html`
      - `fields` (union oneOf) — required
        `map string to HighlightField` or `[] map string to HighlightField`
    - `ignore_unmapped` (boolean) — optional
    - `script_fields` (map string to ScriptField) — optional
      Map values ({} ScriptField)
      - `script` (string Script) — required
      - `ignore_failure` (boolean) — optional
    - `seq_no_primary_term` (boolean) — optional
    - `field` ([] string Field) — optional
    - `fields` ([] FieldAndFormat) — optional
      - `field` (string Field) — required
        A wildcard pattern. The request returns values for field names matching this pattern.
      - `format` (string) — optional
        The format in which the values are returned.
      - `include_unmapped` (boolean) — optional
    - `sort` (Sort) — optional
      How the inner hits should be sorted per `inner_hits`.
By default, inner hits are sorted by score.
    - `_source` (SourceConfig) — optional
    - `stored_fields` (string Fields) — optional
    - `track_scores` (boolean · default: false) — optional
    - `version` (boolean) — optional
  - `max_concurrent_group_searches` (number) — optional
    The number of concurrent requests allowed to retrieve the inner_hits per group
  - `collapse` ({} FieldCollapse) — optional — recursive
    Same fields as `collapse`
- `explain` (boolean · default: false) — optional
  If true, returns detailed information about score computation as part of a hit.
- `ext` (map string to object) — optional
  Configuration of search extensions defined by Elasticsearch plugins.
- `from` (number · default: 0) — optional
  Starting document offset. By default, you cannot page through more than 10,000
hits using the from and size parameters. To page through more hits, use the
search_after parameter.
- `highlight` ({} Highlight) — optional
  Same fields as `highlight` in `inner_hits`
- `track_total_hits` (boolean | number) — optional
  Number of hits matching the query to count accurately. If true, the exact
number of hits is returned at the cost of some performance. If false, the
response does not include the total number of hits matching the query.
Defaults to 10,000 hits.
- `indices_boost` ([] string to number) — optional
  Boosts the _score of documents from specified indices.
- `docvalue_fields` ([] FieldAndFormat) — optional
  Array of wildcard (*) patterns. The request returns doc values for field
names matching these patterns in the hits.fields property of the response.
  - `field` (string Field) — required
    A wildcard pattern. The request returns values for field names matching this pattern.
  - `format` (string) — optional
    The format in which the values are returned.
  - `include_unmapped` (boolean) — optional
- `knn` (union oneOf) — optional
  Defines the approximate kNN search to run.
  `KnnSearch` or `KnnSearch[]`
  - `field` (string Field) — required
    The name of the vector field to search against
  - `query_vector` (QueryVector) — optional
    The query vector
  - `query_vector_builder` ({} QueryVectorBuilder) — optional
    The query vector builder. You must provide a query_vector_builder or query_vector, but not both.
    - `embedding` ({} Embedding) — optional
      - `inference_id` (string) — optional
      - `input` (KnnEmbeddingInput) — required
      - `timeout` (string Duration) — optional
    - `text_embedding` ({} TextEmbedding) — optional
      - `model_id` (string) — optional
        Model ID is required for all dense_vector fields but
may be inferred for semantic_text fields
      - `model_text` (string) — required
        The text to be converted into a vector by the specified model
    - `lookup` ({} LookupQueryVectorBuilder) — optional
      Lookup a vector from an existing document.
Must reference a dense_vector field and a single value.
      - `id` (string) — required
        The ID of the document to fetch the vector from
      - `index` (string) — required
        The name of the index to fetch the document from
      - `path` (string) — required
        The name of the field containing the vector
      - `routing` (string) — optional
        The routing value to use when fetching the document
  - `k` (number) — optional
    The final number of nearest neighbors to return as top hits
  - `num_candidates` (number) — optional
    The number of nearest neighbor candidates to consider per shard
  - `visit_percentage` (number) — optional
    The percentage of vectors to explore per shard while doing knn search with bbq_disk
  - `boost` (number) — optional
    Boost value to apply to kNN scores
  - `filter` (union oneOf) — optional
    Filters for the kNN search query
    One of: [`QueryContainer[]`](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer) or [`QueryContainer`](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
    See [QueryContainer](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
  - `similarity` (number) — optional
    The minimum similarity for a vector to be considered a match
  - `inner_hits` ({} InnerHits) — optional
    If defined, each search hit will contain inner hits.
    - `name` (string Name) — optional
      The name for the particular inner hit definition in the response.
Useful when a search request contains multiple inner hits.
    - `size` (number · default: 3) — optional
      The maximum number of hits to return per `inner_hits`.
    - `from` (number · default: 0) — optional
      Inner hit starting document offset.
    - `collapse` ({} FieldCollapse) — optional
      - `field` (string Field) — required
        The field to collapse the result set on
      - `inner_hits` (union oneOf) — optional — recursive
        The number of inner hits and their sort order
        `InnerHits` or `InnerHits[]`
      - `max_concurrent_group_searches` (number) — optional
        The number of concurrent requests allowed to retrieve the inner_hits per group
      - `collapse` ({} FieldCollapse) — optional — recursive
        Same fields as `collapse` in `inner_hits`
    - `docvalue_fields` ([] FieldAndFormat) — optional
      - `field` (string Field) — required
        A wildcard pattern. The request returns values for field names matching this pattern.
      - `format` (string) — optional
        The format in which the values are returned.
      - `include_unmapped` (boolean) — optional
    - `explain` (boolean) — optional
    - `highlight` ({} Highlight) — optional
      Same fields as `highlight` in `inner_hits`
    - `ignore_unmapped` (boolean) — optional
    - `script_fields` (map string to ScriptField) — optional
      Map values ({} ScriptField)
      - `script` (string Script) — required
      - `ignore_failure` (boolean) — optional
    - `seq_no_primary_term` (boolean) — optional
    - `field` ([] string Field) — optional
    - `fields` ([] FieldAndFormat) — optional
      - `field` (string Field) — required
        A wildcard pattern. The request returns values for field names matching this pattern.
      - `format` (string) — optional
        The format in which the values are returned.
      - `include_unmapped` (boolean) — optional
    - `sort` (Sort) — optional
      How the inner hits should be sorted per `inner_hits`.
By default, inner hits are sorted by score.
    - `_source` (SourceConfig) — optional
    - `stored_fields` (string Fields) — optional
    - `track_scores` (boolean · default: false) — optional
    - `version` (boolean) — optional
  - `rescore_vector` ({} RescoreVector) — optional
    Apply oversampling and rescoring to quantized vectors
    - `oversample` (number) — required
      Applies the specified oversample factor to k on the approximate kNN search
  - `_name` (string) — optional
- `min_score` (number) — optional
  Minimum _score for matching documents. Documents with a lower _score are
not included in search results and results collected by aggregations.
- `post_filter` ({} QueryContainer) — optional
  See [QueryContainer](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
- `profile` (boolean) — optional
- `query` ({} QueryContainer) — optional
  Defines the search definition using the Query DSL.
  See [QueryContainer](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
- `rescore` (union oneOf) — optional
  `Rescore` or `Rescore[]`
  - `window_size` (number) — optional
  - `query` ({} RescoreQuery) — optional
    - `rescore_query` ({} QueryContainer) — required
      The query to use for rescoring.
This query is only run on the Top-K results returned by the `query` and `post_filter` phases.
      See [QueryContainer](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
    - `query_weight` (number · default: 1) — optional
      Relative importance of the original query versus the rescore query.
    - `rescore_query_weight` (number · default: 1) — optional
      Relative importance of the rescore query versus the original query.
    - `score_mode` (enum ScoreMode · default: total) — optional
      Determines how scores are combined.

Supported values include:
  - `avg`: Average the original score and the rescore query score.
  - `max`: Take the max of original score and the rescore query score.
  - `min`: Take the min of the original score and the rescore query score.
  - `multiply`: Multiply the original score by the rescore query score.
Useful for `function` query rescores.
  - `total`: Add the original score and the rescore query score.
      Values: `avg`, `max`, `min`, `multiply`, `total`
  - `learning_to_rank` ({} LearningToRank) — optional
    - `model_id` (string) — required
      The unique identifier of the trained model uploaded to Elasticsearch
    - `params` (map string to object) — optional
      Named parameters to be passed to the query templates used for feature
  - `script` ({} ScriptRescore) — optional
    - `script` (string Script) — required
- `script_fields` (map string to ScriptField) — optional
  Retrieve a script evaluation (based on different fields) for each hit.
  Map values ({} ScriptField)
  - `script` (string Script) — required
  - `ignore_failure` (boolean) — optional
- `search_after` (SortResults) — optional
- `size` (number · default: 10) — optional
  The number of hits to return. By default, you cannot page through more
than 10,000 hits using the from and size parameters. To page through more
hits, use the search_after parameter.
- `slice` ({} SlicedScroll) — optional
  - `field` (string Field) — optional
  - `id` (string Id) — required
  - `max` (number) — required
- `sort` (Sort) — optional
- `_source` (SourceConfig) — optional
  Indicates which source fields are returned for matching documents. These
fields are returned in the hits._source property of the search response.
- `fields` ([] FieldAndFormat) — optional
  Array of wildcard (*) patterns. The request returns values for field names
matching these patterns in the hits.fields property of the response.
  - `field` (string Field) — required
    A wildcard pattern. The request returns values for field names matching this pattern.
  - `format` (string) — optional
    The format in which the values are returned.
  - `include_unmapped` (boolean) — optional
- `suggest` ({} Suggester) — optional
  - `text` (string) — optional
    Global suggest text, to avoid repetition when the same text is used in several suggesters
- `terminate_after` (number · default: 0) — optional
  Maximum number of documents to collect for each shard. If a query reaches this
limit, Elasticsearch terminates the query early. Elasticsearch collects documents
before sorting. Defaults to 0, which does not terminate query execution early.
- `timeout` (string) — optional
  Specifies the period of time to wait for a response from each shard. If no response
is received before the timeout expires, the request fails and returns an error.
Defaults to no timeout.
- `track_scores` (boolean · default: false) — optional
  If true, calculate and return document scores, even if the scores are not used for sorting.
- `version` (boolean · default: false) — optional
  If true, returns document version as part of a hit.
- `seq_no_primary_term` (boolean) — optional
  If true, returns sequence number and primary term of the last modification
of each hit. See Optimistic concurrency control.
- `stored_fields` (string Fields) — optional
  List of stored fields to return as part of a hit. If no fields are specified,
no stored fields are included in the response. If this field is specified, the _source
parameter defaults to false. You can pass _source: true to return both source fields
and stored fields in the search response.
- `pit` ({} PointInTimeReference) — optional
  Limits the search to a point in time (PIT). If you provide a PIT, you
cannot specify an <index> in the request path.
  - `id` (string Id) — required
  - `keep_alive` (string Duration) — optional
- `runtime_mappings` (RuntimeFields) — optional
  Defines one or more runtime fields in the search request. These fields take
precedence over mapped fields with the same name.
- `stats` ([] string) — optional
  Stats groups to associate with the search. Each group maintains a statistics
aggregation for its associated searches. You can retrieve these stats using
the indices stats API.

## Response

`application/json`

- `id` (string Id)
- `is_partial` (boolean)
  When the query is no longer running, this property indicates whether the search failed or was successfully completed on all shards.
While the query is running, `is_partial` is always set to `true`.
- `is_running` (boolean)
  Indicates whether the search is still running or has completed.

> info
> If the search failed after some shards returned their results or the node that is coordinating the async search dies, results may be partial even though `is_running` is `false`.
- `expiration_time` (DateTime)
  Indicates when the async search will expire.
- `expiration_time_in_millis` (EpochTimeUnitMillis)
- `start_time` (DateTime)
- `start_time_in_millis` (EpochTimeUnitMillis)
- `completion_time` (DateTime)
  Indicates when the async search completed.
It is present only when the search has completed.
- `completion_time_in_millis` (EpochTimeUnitMillis)
- `error` ({} ErrorCause)
  - `type` (string)
    The type of error
  - `reason` (union string) — nullable
    A human-readable explanation of the error, in English.
    One of: `string`
  - `stack_trace` (string)
    The server stack trace. Present only if the `error_trace=true` parameter was sent with the request.
  - `caused_by` ({} ErrorCause) — recursive
    Same fields as `error`
  - `root_cause` ([] ErrorCause) — recursive
    Same fields as `error`
  - `suppressed` ([] ErrorCause) — recursive
    Same fields as `error`
- `response` ({} AsyncSearch)
  - `aggregations` (map string to {} Aggregate)
    Partial aggregations results, coming from the shards that have already completed running the query.
    See [Aggregate](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-aggregations-aggregate)
  - `_clusters` ({} ClusterStatistics)
    - `skipped` (number)
    - `successful` (number)
    - `total` (number)
    - `running` (number)
    - `partial` (number)
    - `failed` (number)
    - `details` (map string to ClusterDetails)
      Map values ({} ClusterDetails)
      - `status` (enum ClusterSearchStatus)
        Values: `running`, `successful`, `partial`, `skipped`, `failed`
      - `indices` (string)
      - `took` (DurationValueUnitMillis)
      - `timed_out` (boolean)
      - `_shards` ({} ShardStatistics)
        - `failed` (number uint)
          The number of shards the operation or search attempted to run on but failed.
        - `successful` (number uint)
          The number of shards the operation or search succeeded on.
        - `total` (number uint)
          The number of shards the operation or search will run on overall.
        - `failures` ([] ShardFailure)
          - `index` (string IndexName)
          - `node` (string)
          - `reason` ({} ErrorCause)
            - `type` (string)
              The type of error
            - `reason` (union string) — nullable
              A human-readable explanation of the error, in English.
              One of: `string`
            - `stack_trace` (string)
              The server stack trace. Present only if the `error_trace=true` parameter was sent with the request.
            - `caused_by` ({} ErrorCause) — recursive
              Same fields as `reason` in `failures`
            - `root_cause` ([] ErrorCause) — recursive
              Same fields as `reason` in `failures`
            - `suppressed` ([] ErrorCause) — recursive
              Same fields as `reason` in `failures`
          - `shard` (number)
          - `status` (string)
          - `primary` (boolean)
        - `skipped` (number uint)
      - `failures` ([] ShardFailure)
        Same fields as `failures` in `_shards`
  - `fields` (map string to object)
  - `hits` ({} HitsMetadata)
    - `total` (union oneOf)
      Total hit count information, present only if `track_total_hits` wasn't `false` in the search request.
      - **TotalHits**
        - `relation` (enum TotalHitsRelation)
          

Supported values include:
  - `eq`: Accurate
  - `gte`: Lower bound, including returned events or sequences
          Values: `eq`, `gte`
        - `value` (number)
      - **number**
    - `hits` ([] Hit)
      - `_index` (string IndexName)
      - `_id` (string Id)
      - `_score` (union number | string) — nullable
      - `_explanation` ({} Explanation)
        - `description` (string)
        - `details` ([] ExplanationDetail)
          - `description` (string)
          - `details` ([] ExplanationDetail) — recursive
            Same fields as `details` in `_explanation`
          - `value` (number)
        - `value` (number)
      - `fields` (map string to object)
      - `highlight` (map string to string)
      - `inner_hits` (map string to InnerHitsResult)
        Map values ({} InnerHitsResult)
        - `hits` ({} HitsMetadata) — recursive
          Same fields as `hits` in `response`
      - `matched_queries` (union oneOf)
        One of: `string[]` or `string to number`
      - `_nested` ({} NestedIdentity)
        - `field` (string Field)
        - `offset` (number)
        - `_nested` ({} NestedIdentity) — recursive
          Same fields as `_nested` in `hits`
      - `_ignored` ([] string)
      - `ignored_field_values` (map string to object)
      - `_shard` (string)
      - `_node` (string)
      - `_routing` (string)
      - `_source` (object)
      - `_rank` (number)
      - `_seq_no` (number SequenceNumber)
      - `_primary_term` (number)
      - `_version` (number VersionNumber)
      - `sort` (SortResults)
    - `max_score` (union number | string) — nullable
  - `max_score` (number)
  - `num_reduce_phases` (number)
    Indicates how many reductions of the results have been performed.
If this number increases compared to the last retrieved results for a get asynch search request, you can expect additional results included in the search response.
  - `profile` ({} Profile)
    - `shards` ([] ShardProfile)
      - `aggregations` ([] AggregationProfile)
        - `breakdown` ({} AggregationBreakdown)
          - `build_aggregation` (number)
          - `build_aggregation_count` (number)
          - `build_leaf_collector` (number)
          - `build_leaf_collector_count` (number)
          - `collect` (number)
          - `collect_count` (number)
          - `initialize` (number)
          - `initialize_count` (number)
          - `post_collection` (number)
          - `post_collection_count` (number)
          - `reduce` (number)
          - `reduce_count` (number)
        - `description` (string)
        - `time_in_nanos` (DurationValueUnitNanos)
        - `type` (string)
        - `debug` ({} AggregationProfileDebug)
          - `segments_with_multi_valued_ords` (number)
          - `collection_strategy` (string)
          - `segments_with_single_valued_ords` (number)
          - `total_buckets` (number)
          - `built_buckets` (number)
          - `result_strategy` (string)
          - `has_filter` (boolean)
          - `delegate` (string)
          - `delegate_debug` ({} AggregationProfileDebug) — recursive
            Same fields as `debug` in `aggregations`
          - `chars_fetched` (number)
          - `extract_count` (number)
          - `extract_ns` (number)
          - `values_fetched` (number)
          - `collect_analyzed_ns` (number)
          - `collect_analyzed_count` (number)
          - `surviving_buckets` (number)
          - `ordinals_collectors_used` (number)
          - `ordinals_collectors_overhead_too_high` (number)
          - `string_hashing_collectors_used` (number)
          - `numeric_collectors_used` (number)
          - `empty_collectors_used` (number)
          - `deferred_aggregators` ([] string)
          - `segments_with_doc_count_field` (number)
          - `segments_with_deleted_docs` (number)
          - `filters` ([] AggregationProfileDelegateDebugFilter)
            - `results_from_metadata` (number)
            - `query` (string)
            - `specialized_for` (string)
            - `segments_counted_in_constant_time` (number)
          - `segments_counted` (number)
          - `segments_collected` (number)
          - `map_reducer` (string)
          - `brute_force_used` (number)
          - `dynamic_pruning_attempted` (number)
          - `dynamic_pruning_used` (number)
          - `skipped_due_to_no_data` (number)
        - `children` ([] AggregationProfile) — recursive
          Same fields as `aggregations` in `shards`
      - `cluster` (string)
      - `dfs` ({} DfsProfile)
        - `statistics` ({} DfsStatisticsProfile)
          - `type` (string)
          - `description` (string)
          - `time` (string Duration)
          - `time_in_nanos` (DurationValueUnitNanos)
          - `breakdown` ({} DfsStatisticsBreakdown)
            - `collection_statistics` (number)
            - `collection_statistics_count` (number)
            - `create_weight` (number)
            - `create_weight_count` (number)
            - `rewrite` (number)
            - `rewrite_count` (number)
            - `term_statistics` (number)
            - `term_statistics_count` (number)
          - `debug` (map string to object)
          - `children` ([] DfsStatisticsProfile) — recursive
            Same fields as `statistics` in `dfs`
        - `knn` ([] DfsKnnProfile)
          - `vector_operations_count` (number)
          - `query` ([] KnnQueryProfileResult)
            - `type` (string)
            - `description` (string)
            - `time` (string Duration)
            - `time_in_nanos` (DurationValueUnitNanos)
            - `breakdown` ({} KnnQueryProfileBreakdown)
              - `advance` (number)
              - `advance_count` (number)
              - `build_scorer` (number)
              - `build_scorer_count` (number)
              - `compute_max_score` (number)
              - `compute_max_score_count` (number)
              - `count_weight` (number)
              - `count_weight_count` (number)
              - `create_weight` (number)
              - `create_weight_count` (number)
              - `match` (number)
              - `match_count` (number)
              - `next_doc` (number)
              - `next_doc_count` (number)
              - `score` (number)
              - `score_count` (number)
              - `set_min_competitive_score` (number)
              - `set_min_competitive_score_count` (number)
              - `shallow_advance` (number)
              - `shallow_advance_count` (number)
            - `debug` (map string to object)
            - `children` ([] KnnQueryProfileResult) — recursive
              Same fields as `query` in `knn`
          - `rewrite_time` (number)
          - `collector` ([] KnnCollectorResult)
            - `name` (string)
            - `reason` (string)
            - `time` (string Duration)
            - `time_in_nanos` (DurationValueUnitNanos)
            - `children` ([] KnnCollectorResult) — recursive
              Same fields as `collector` in `knn`
      - `fetch` ({} FetchProfile)
        - `type` (string)
        - `description` (string)
        - `time_in_nanos` (DurationValueUnitNanos)
        - `breakdown` ({} FetchProfileBreakdown)
          - `load_source` (number)
          - `load_source_count` (number)
          - `load_stored_fields` (number)
          - `load_stored_fields_count` (number)
          - `next_reader` (number)
          - `next_reader_count` (number)
          - `process_count` (number)
          - `process` (number)
        - `debug` ({} FetchProfileDebug)
          - `stored_fields` ([] string)
          - `fast_path` (number)
        - `children` ([] FetchProfile) — recursive
          Same fields as `fetch` in `shards`
      - `id` (string)
      - `index` (string IndexName)
      - `node_id` (string)
      - `searches` ([] SearchProfile)
        - `collector` ([] Collector)
          - `name` (string)
          - `reason` (string)
          - `time_in_nanos` (DurationValueUnitNanos)
          - `children` ([] Collector) — recursive
            Same fields as `collector` in `searches`
        - `query` ([] QueryProfile)
          - `breakdown` ({} QueryBreakdown)
            - `advance` (number)
            - `advance_count` (number)
            - `build_scorer` (number)
            - `build_scorer_count` (number)
            - `create_weight` (number)
            - `create_weight_count` (number)
            - `match` (number)
            - `match_count` (number)
            - `shallow_advance` (number)
            - `shallow_advance_count` (number)
            - `next_doc` (number)
            - `next_doc_count` (number)
            - `score` (number)
            - `score_count` (number)
            - `compute_max_score` (number)
            - `compute_max_score_count` (number)
            - `count_weight` (number)
            - `count_weight_count` (number)
            - `set_min_competitive_score` (number)
            - `set_min_competitive_score_count` (number)
          - `description` (string)
          - `time_in_nanos` (DurationValueUnitNanos)
          - `type` (string)
          - `children` ([] QueryProfile) — recursive
            Same fields as `query` in `searches`
        - `rewrite_time` (number)
      - `shard_id` (number)
    - `request` ({} SearchRequestCoordinatorMetadata)
      When profiling is enabled, the original query source and target indices from the coordinating request.
      - `source` ({} SearchRequestBody)
        Original query source from the search request (`SearchSourceBuilder` as JSON).
        - `aggregations` (map string to {} AggregationContainer)
          Defines the aggregations that are run as part of the search request.
          See [AggregationContainer](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-aggregations-aggregationcontainer)
        - `collapse` ({} FieldCollapse)
          Collapses search results the values of the specified field.
          Same fields as `collapse`
        - `explain` (boolean · default: false)
          If `true`, the request returns detailed information about score computation as part of a hit.
        - `ext` (map string to object)
          Configuration of search extensions defined by Elasticsearch plugins.
        - `from` (number · default: 0)
          The starting document offset, which must be non-negative.
By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.
To page through more hits, use the `search_after` parameter.
        - `highlight` ({} Highlight)
          Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results.
          Same fields as `highlight` in `inner_hits`
        - `track_total_hits` (boolean | number · default: 10000)
          Number of hits matching the query to count accurately.
If `true`, the exact number of hits is returned at the cost of some performance.
If `false`, the  response does not include the total number of hits matching the query.
        - `indices_boost` ([] string to number)
          Boost the `_score` of documents from specified indices.
The boost value is the factor by which scores are multiplied.
A boost value greater than `1.0` increases the score.
A boost value between `0` and `1.0` decreases the score.
        - `docvalue_fields` ([] FieldAndFormat)
          An array of wildcard (`*`) field patterns.
The request returns doc values for field names matching these patterns in the `hits.fields` property of the response.
          - `field` (string Field)
            A wildcard pattern. The request returns values for field names matching this pattern.
          - `format` (string)
            The format in which the values are returned.
          - `include_unmapped` (boolean)
        - `knn` (union oneOf)
          The approximate kNN search to run.
          Same options as `knn`
          `KnnSearch` or `KnnSearch[]`
        - `min_score` (number)
          The minimum `_score` for matching documents.
Documents with a lower `_score` are not included in search results or results collected by aggregations.
        - `post_filter` ({} QueryContainer)
          Use the `post_filter` parameter to filter search results.
The search hits are filtered after the aggregations are calculated.
A post filter has no impact on the aggregation results.
          See [QueryContainer](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
        - `profile` (boolean · default: false)
          Set to `true` to return detailed timing information about the execution of individual components in a search request.
NOTE: This is a debugging tool and adds significant overhead to search execution.
        - `query` ({} QueryContainer)
          The search definition using the Query DSL.
          See [QueryContainer](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
        - `rescore` (union oneOf)
          Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the `query` and `post_filter` phases.
          Same options as `rescore`
          `Rescore` or `Rescore[]`
        - `retriever` ({} RetrieverContainer)
          A retriever is a specification to describe top documents returned from a search.
A retriever replaces other elements of the search API that also return top documents such as `query` and `knn`.
          - `standard` ({} StandardRetriever)
            A retriever that replaces the functionality of a traditional query.
            - `filter` (union oneOf)
              Query to filter the documents that can match.
              One of: [`QueryContainer[]`](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer) or [`QueryContainer`](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
              See [QueryContainer](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
            - `min_score` (number)
              Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
            - `_name` (string)
              Retriever name.
            - `query` ({} QueryContainer)
              Defines a query to retrieve a set of top documents.
              See [QueryContainer](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
            - `search_after` (SortResults)
              Defines a search after object parameter used for pagination.
            - `terminate_after` (number)
              Maximum number of documents to collect for each shard.
            - `sort` (Sort)
              A sort object that that specifies the order of matching documents.
            - `collapse` ({} FieldCollapse)
              Collapses the top documents by a specified key into a single top document per key.
              Same fields as `collapse`
          - `knn` ({} KnnRetriever)
            A retriever that replaces the functionality  of a knn search.
            - `filter` (union oneOf)
              Query to filter the documents that can match.
              One of: [`QueryContainer[]`](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer) or [`QueryContainer`](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
              See [QueryContainer](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
            - `min_score` (number)
              Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
            - `_name` (string)
              Retriever name.
            - `field` (string)
              The name of the vector field to search against.
            - `query_vector` (QueryVector)
              Query vector. Must have the same number of dimensions as the vector field you are searching against. You must provide a query_vector_builder or query_vector, but not both.
            - `query_vector_builder` ({} QueryVectorBuilder)
              Defines a model to build a query vector.
              Same fields as `query_vector_builder` in `knn`
            - `k` (number)
              Number of nearest neighbors to return as top hits.
            - `num_candidates` (number)
              Number of nearest neighbor candidates to consider per shard.
            - `visit_percentage` (number)
              The percentage of vectors to explore per shard while doing knn search with bbq_disk
            - `similarity` (number)
              The minimum similarity required for a document to be considered a match.
            - `rescore_vector` ({} RescoreVector)
              Apply oversampling and rescoring to quantized vectors
              - `oversample` (number)
                Applies the specified oversample factor to k on the approximate kNN search
          - `rrf` ({} RRFRetriever)
            A retriever that produces top documents from reciprocal rank fusion (RRF).
            - `filter` (union oneOf)
              Query to filter the documents that can match.
              One of: [`QueryContainer[]`](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer) or [`QueryContainer`](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
              See [QueryContainer](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
            - `min_score` (number)
              Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
            - `_name` (string)
              Retriever name.
            - `retrievers` ([] union RRFRetrieverEntry) — recursive
              A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. Each retriever can optionally include a weight parameter.
            - `rank_constant` (number)
              This value determines how much influence documents in individual result sets per query have over the final ranked result set.
            - `rank_window_size` (number)
              This value determines the size of the individual result sets per query.
            - `query` (string)
            - `fields` ([] string)
          - `text_similarity_reranker` ({} TextSimilarityReranker)
            A retriever that reranks the top documents based on a reranking model using the InferenceAPI
            - `filter` (union oneOf)
              Query to filter the documents that can match.
              One of: [`QueryContainer[]`](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer) or [`QueryContainer`](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
              See [QueryContainer](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
            - `min_score` (number)
              Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
            - `_name` (string)
              Retriever name.
            - `retriever` ({} RetrieverContainer) — recursive
              The nested retriever which will produce the first-level results, that will later be used for reranking.
              Same fields as `retriever` in `source`
            - `rank_window_size` (number)
              This value determines how many documents we will consider from the nested retriever.
            - `inference_id` (string)
              Unique identifier of the inference endpoint created using the inference API.
            - `inference_text` (string)
              The text snippet used as the basis for similarity comparison.
            - `field` (string)
              The document field to be used for text similarity comparisons. This field should contain the text that will be evaluated against the inference_text.
            - `chunk_rescorer` ({} ChunkRescorer)
              Whether to rescore on only the best matching chunks.
              - `size` (number)
                The number of chunks per document to evaluate for reranking.
              - `chunking_settings` ({} ChunkRescorerChunkingSettings)
                Chunking settings to apply
                - `max_chunk_size` (number · default: 250)
                  The maximum size of a chunk in words.
This value cannot be lower than `20` (for `sentence` strategy) or `10` (for `word` strategy).
This value should not exceed the window size for the associated model.
                - `overlap` (number · default: 100)
                  The number of overlapping words for chunks.
It is applicable only to a `word` chunking strategy.
This value cannot be higher than half the `max_chunk_size` value.
                - `sentence_overlap` (number · default: 1)
                  The number of overlapping sentences for chunks.
It is applicable only for a `sentence` chunking strategy.
It can be either `1` or `0`.
                - `separator_group` (string)
                  Only applicable to the `recursive` strategy and required when using it.

Sets a predefined list of separators in the saved chunking settings based on the selected text type.
Values can be `markdown` or `plaintext`.

Using this parameter is an alternative to manually specifying a custom `separators` list.
                - `separators` ([] string)
                  Only applicable to the `recursive` strategy and required when using it.

A list of strings used as possible split points when chunking text.

Each string can be a plain string or a regular expression (regex) pattern.
The system tries each separator in order to split the text, starting from the first item in the list.

After splitting, it attempts to recombine smaller pieces into larger chunks that stay within
the `max_chunk_size` limit, to reduce the total number of chunks generated.
                - `strategy` (string · default: sentence)
                  The chunking strategy: `sentence`, `word`, `none` or `recursive`.

 * If `strategy` is set to `recursive`, you must also specify:

- `max_chunk_size`
- either `separators` or`separator_group`

Learn more about different chunking strategies in the linked documentation.
          - `rule` ({} RuleRetriever)
            A retriever that replaces the functionality of a rule query.
            - `filter` (union oneOf)
              Query to filter the documents that can match.
              One of: [`QueryContainer[]`](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer) or [`QueryContainer`](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
              See [QueryContainer](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
            - `min_score` (number)
              Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
            - `_name` (string)
              Retriever name.
            - `ruleset_ids` (union Id | [] Id)
              The ruleset IDs containing the rules this retriever is evaluating against.
            - `match_criteria` (object)
              The match criteria that will determine if a rule in the provided rulesets should be applied.
            - `retriever` ({} RetrieverContainer) — recursive
              The retriever whose results rules should be applied to.
              Same fields as `retriever` in `source`
            - `rank_window_size` (number)
              This value determines the size of the individual result set.
          - `rescorer` ({} RescorerRetriever)
            A retriever that re-scores only the results produced by its child retriever.
            - `filter` (union oneOf)
              Query to filter the documents that can match.
              One of: [`QueryContainer[]`](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer) or [`QueryContainer`](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
              See [QueryContainer](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
            - `min_score` (number)
              Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
            - `_name` (string)
              Retriever name.
            - `retriever` ({} RetrieverContainer) — recursive
              Inner retriever.
              Same fields as `retriever` in `source`
            - `rescore` (union oneOf)
              Same options as `rescore`
              `Rescore` or `Rescore[]`
          - `linear` ({} LinearRetriever)
            A retriever that supports the combination of different retrievers through a weighted linear combination.
            - `filter` (union oneOf)
              Query to filter the documents that can match.
              One of: [`QueryContainer[]`](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer) or [`QueryContainer`](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
              See [QueryContainer](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
            - `min_score` (number)
              Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
            - `_name` (string)
              Retriever name.
            - `retrievers` ([] InnerRetriever)
              Inner retrievers.
              - `retriever` ({} RetrieverContainer) — recursive
                The nested retriever configuration.
                Same fields as `retriever` in `source`
              - `weight` (number · default: 1)
                Weight multiplier for this retriever's contribution to the linear combination.
Must be non-negative.
              - `normalizer` (enum ScoreNormalizer · default: none)
                Score normalizer to apply to this retriever's results before weighting.
Falls back to the top-level `normalizer` on the linear retriever if unset,
then to `none` (identity) if neither is set.
                Values: `none`, `minmax`, `l2_norm`
            - `rank_window_size` (number)
            - `query` (string)
            - `fields` ([] string)
            - `normalizer` (enum ScoreNormalizer)
              Values: `none`, `minmax`, `l2_norm`
          - `pinned` ({} PinnedRetriever)
            A pinned retriever applies pinned documents to the underlying retriever.
This retriever will rewrite to a PinnedQueryBuilder.
            - `filter` (union oneOf)
              Query to filter the documents that can match.
              One of: [`QueryContainer[]`](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer) or [`QueryContainer`](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
              See [QueryContainer](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
            - `min_score` (number)
              Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
            - `_name` (string)
              Retriever name.
            - `retriever` ({} RetrieverContainer) — recursive
              Inner retriever.
              Same fields as `retriever` in `source`
            - `ids` ([] string)
            - `docs` ([] SpecifiedDocument)
              - `index` (string IndexName)
              - `id` (string Id)
            - `rank_window_size` (number)
          - `diversify` ({} DiversifyRetriever)
            A retriever that diversifies the results from its child retriever.
            - `filter` (union oneOf)
              Query to filter the documents that can match.
              One of: [`QueryContainer[]`](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer) or [`QueryContainer`](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
              See [QueryContainer](https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch-serverless/types/_types-query_dsl-querycontainer)
            - `min_score` (number)
              Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
            - `_name` (string)
              Retriever name.
            - `type` (enum DiversifyRetrieverTypes)
              The diversification strategy to apply.
              Values: `mmr`
            - `field` (string)
              The document field on which to diversify results on.
            - `retriever` ({} RetrieverContainer) — recursive
              The nested retriever whose results will be diversified.
              Same fields as `retriever` in `source`
            - `size` (number)
              The number of top documents to return after diversification.
            - `rank_window_size` (number)
              The number of top documents from the nested retriever to consider for diversification.
            - `query_vector` (QueryVector)
              The query vector used for diversification.
            - `query_vector_builder` ({} QueryVectorBuilder)
              a dense vector query vector builder to use instead of a static query_vector
              Same fields as `query_vector_builder` in `knn`
            - `lambda` (number)
              Controls the trade-off between relevance and diversity for MMR. A value of 0.0 focuses solely on diversity, while a value of 1.0 focuses solely on relevance. Required for MMR
        - `script_fields` (map string to ScriptField)
          Retrieve a script evaluation (based on different fields) for each hit.
          Map values ({} ScriptField)
          - `script` (string Script)
          - `ignore_failure` (boolean)
        - `search_after` (SortResults)
          Used to retrieve the next page of hits using a set of sort values from the previous page.
        - `size` (number · default: 10)
          The number of hits to return, which must not be negative.
By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.
To page through more hits, use the `search_after` property.
        - `slice` ({} SlicedScroll)
          Split a scrolled search into multiple slices that can be consumed independently.
          - `field` (string Field)
          - `id` (string Id)
          - `max` (number)
        - `sort` (Sort)
          A comma-separated list of <field>:<direction> pairs.
        - `_source` (SourceConfig)
          The source fields that are returned for matching documents.
These fields are returned in the `hits._source` property of the search response.
If the `stored_fields` property is specified, the `_source` property defaults to `false`.
Otherwise, it defaults to `true`.
        - `fields` ([] FieldAndFormat)
          An array of wildcard (`*`) field patterns.
The request returns values for field names matching these patterns in the `hits.fields` property of the response.
          - `field` (string Field)
            A wildcard pattern. The request returns values for field names matching this pattern.
          - `format` (string)
            The format in which the values are returned.
          - `include_unmapped` (boolean)
        - `suggest` ({} Suggester)
          Defines a suggester that provides similar looking terms based on a provided text.
          - `text` (string)
            Global suggest text, to avoid repetition when the same text is used in several suggesters
        - `terminate_after` (number · default: 0)
          The maximum number of documents to collect for each shard.
If a query reaches this limit, Elasticsearch terminates the query early.
Elasticsearch collects documents before sorting.

IMPORTANT: Use with caution.
Elasticsearch applies this property to each shard handling the request.
When possible, let Elasticsearch perform early termination automatically.
Avoid specifying this property for requests that target data streams with backing indices across multiple data tiers.

If set to `0` (default), the query does not terminate early.
        - `timeout` (string)
          The period of time to wait for a response from each shard.
If no response is received before the timeout expires, the request fails and returns an error.
Defaults to no timeout.
        - `track_scores` (boolean · default: false)
          If `true`, calculate and return document scores, even if the scores are not used for sorting.
        - `version` (boolean · default: false)
          If `true`, the request returns the document version as part of a hit.
        - `seq_no_primary_term` (boolean)
          If `true`, the request returns sequence number and primary term of the last modification of each hit.
        - `stored_fields` (string Fields)
          A comma-separated list of stored fields to return as part of a hit.
If no fields are specified, no stored fields are included in the response.
If this field is specified, the `_source` property defaults to `false`.
You can pass `_source: true` to return both source fields and stored fields in the search response.
        - `pit` ({} PointInTimeReference)
          Limit the search to a point in time (PIT).
If you provide a PIT, you cannot specify an `<index>` in the request path.
          - `id` (string Id)
          - `keep_alive` (string Duration)
        - `runtime_mappings` (RuntimeFields)
          One or more runtime fields in the search request.
These fields take precedence over mapped fields with the same name.
        - `stats` ([] string)
          The stats groups to associate with the search.
Each group maintains a statistics aggregation for its associated searches.
You can retrieve these stats using the indices stats API.
      - `indices` ([] string IndexName)
        Target index expressions from the request (before index resolution).
  - `pit_id` (string Id)
  - `_scroll_id` (string ScrollId)
  - `_shards` ({} ShardStatistics)
    Indicates how many shards have run the query.
Note that in order for shard results to be included in the search response, they need to be reduced first.
    Same fields as `_shards` in `details`
  - `suggest` (map string to Suggest)
  - `terminated_early` (boolean)
  - `timed_out` (boolean)
  - `took` (number)
## Code Examples

#### Console

```console
POST /sales*/_async_search?size=0
{
  "sort": [
    { "date": { "order": "asc" } }
  ],
  "aggs": {
    "sale_date": {
      "date_histogram": {
        "field": "date",
        "calendar_interval": "1d"
      }
    }
  }
}
```

#### JavaScript

```javascript
const response = await client.asyncSearch.submit({
  index: "sales*",
  size: 0,
  sort: [
    {
      date: {
        order: "asc",
      },
    },
  ],
  aggs: {
    sale_date: {
      date_histogram: {
        field: "date",
        calendar_interval: "1d",
      },
    },
  },
});
```

#### Python

```python
resp = client.async_search.submit(
    index="sales*",
    size="0",
    sort=[
        {
            "date": {
                "order": "asc"
            }
        }
    ],
    aggs={
        "sale_date": {
            "date_histogram": {
                "field": "date",
                "calendar_interval": "1d"
            }
        }
    },
)
```

#### curl

```curl
curl -X POST "$ELASTICSEARCH_URL/sales*/_async_search?size=0" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "sort": [
      {
        "date": {
          "order": "asc"
        }
      }
    ],
    "aggs": {
      "sale_date": {
        "date_histogram": {
          "field": "date",
          "calendar_interval": "1d"
        }
      }
    }
  }'
```

#### Java

```java
client.asyncSearch().submit(s -> s
    .aggregations("sale_date", a -> a
        .dateHistogram(d -> d
            .calendarInterval(CalendarInterval.Day)
            .field("date")
        )
    )
    .index("sales*")
    .size(0)
    .sort(so -> so
        .field(f -> f
            .field("date")
            .order(SortOrder.Asc)
        )
    )
,Void.class);
```

#### C#

```c#
var response = await client.AsyncSearch
    .SubmitAsync<MyDocument>(d1 => d1
        .Indices(new[] { "sales*" })
        .Aggregations(d2 => d2
            .Add("sale_date", d3 => d3
                .DateHistogram(d4 => d4
                    .CalendarInterval(CalendarInterval.Day)
                    .Field(x => x.Date)
                )
            )
        )
        .Sort(d2 => d2
            .Field(d3 => d3
                .Field(x => x.Date)
                .Order(SortOrder.Asc)
            )
        )
    );
```

#### PHP

```php
$resp = $client->asyncSearch()->submit([
    "index" => "sales*",
    "size" => "0",
    "body" => [
        "sort" => array(
            [
                "date" => [
                    "order" => "asc",
                ],
            ],
        ),
        "aggs" => [
            "sale_date" => [
                "date_histogram" => [
                    "field" => "date",
                    "calendar_interval" => "1d",
                ],
            ],
        ],
    ],
]);
```

#### Ruby

```ruby
response = client.async_search.submit(
  index: "sales*",
  size: "0",
  body: {
    "sort": [
      {
        "date": {
          "order": "asc"
        }
      }
    ],
    "aggs": {
      "sale_date": {
        "date_histogram": {
          "field": "date",
          "calendar_interval": "1d"
        }
      }
    }
  }
)
```

## Response Examples

#### Async search submit response example1

A successful response when performing search asynchronously.

```json
{
  "id" : "FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=",
  "is_partial" : true,
  "is_running" : true,
  "start_time_in_millis" : 1583945890986,
  "expiration_time_in_millis" : 1584377890986,
  "response" : {
    "took" : 1122,
    "timed_out" : false,
    "num_reduce_phases" : 0,
    "_shards" : {
      "total" : 562,
      "successful" : 3,
      "skipped" : 0,
      "failed" : 0
    },
    "hits" : {
      "total" : {
        "value" : 157483,
        "relation" : "gte"
      },
      "max_score" : null,
      "hits" : [ ]
    }
  }
}
```

