Run an async search
- POST /{index}/_async_search
- POST /_async_search
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.
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 parameters
-
wait_for_completion_timeoutstring · 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_alivestring · 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_completionboolean · default: false -
If
true, results are stored for later retrieval when the search completes within thewait_for_completion_timeout. -
allow_no_indicesboolean -
A setting that does two separate checks on the index expression. If
false, the request returns an error (1) if any wildcard expression (including_alland*) 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. Iftrue, index expressions that resolve to no indices are allowed and the request returns an empty result. -
allow_partial_search_resultsboolean · default: true -
Indicate if an error should be returned if there is a partial search failure or timeout
-
analyze_wildcardboolean · default: false -
Specify whether wildcard and prefix queries should be analyzed
-
batched_reduce_sizenumber · 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).
-
default_operatorenum · default: or -
The default operator for query string query (AND or OR)
-
Values:
andANDorOR -
docvalue_fieldsunion string | string[] -
A comma-separated list of fields to return as the docvalue representation of a field for each hit
-
expand_wildcardsunion oneOf · 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 withopen,closed, orboth.none: Wildcard expressions are not accepted.
-
Values:
allopenclosedhiddennone -
explainboolean -
Specify whether to return detailed information about score computation as part of a hit
-
ignore_throttledboolean -
Whether specified concrete, expanded or aliased indices should be ignored when throttled
-
ignore_unavailableboolean -
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. Iftrue, unavailable concrete targets are silently ignored. -
lenientboolean -
Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
-
max_concurrent_shard_requestsnumber · 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
-
request_cacheboolean · default: true -
Specify if request cache should be used for this request or not, defaults to true
-
search_typeenum -
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_fetchdfs_query_then_fetch -
stored_fieldsunion string | string[] -
A comma-separated list of stored fields to return as part of a hit
-
suggest_modeenum · 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:
missingpopularalways -
terminate_afternumber -
The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early
-
track_total_hitsboolean | 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.
-
typed_keysboolean -
Specify whether aggregation and suggester names should be prefixed by their respective types in the response
-
rest_total_hits_as_intboolean · default: false -
Indicates whether hits.total should be rendered as an integer or an object in the rest search response
-
_sourceunion oneOf -
True or false to return the _source field or not, or a list of fields to return
-
One of:
booleanorstring -
_source_excludesunion string | string[] -
A list of fields to exclude from the returned _source field
-
_source_includesunion string | string[] -
A list of fields to extract and return from the _source field
Request body
-
aggregationsmap string to {} Aggregation -
collapseobject -
inner_hitsunion oneOf -
The number of inner hits and their sort order
-
objectorobject[] -
namestring -
The name for the particular inner hit definition in the response. Useful when a search request contains multiple inner hits.
-
collapseobject -
Same fields as
collapse -
highlightobject -
typeunion anyOf -
Supported values include:
plain: Theplainhighlighter uses the standard Lucene highlighterfvh: The fvh highlighter uses the Lucene Fast Vector highlighter.unified: The unified highlighter uses the Lucene Unified Highlighter.
-
Values:
plainfvhunified -
boundary_scannerenum -
Specifies how to break the highlighted fragments: chars, sentence, or word. Only valid for the unified and fvh highlighters. Defaults to
sentencefor theunifiedhighlighter. Defaults tocharsfor thefvhhighlighter.Supported values include:
chars: Use the characters specified byboundary_charsas highlighting boundaries. Theboundary_max_scansetting controls how far to scan for boundary characters. Only valid for thefvhhighlighter.sentence: Break highlighted fragments at the next sentence boundary, as determined by Java’sBreakIterator. You can specify the locale to use withboundary_scanner_locale. When used with theunifiedhighlighter, thesentencescanner splits sentences bigger thanfragment_sizeat the first word boundary next to fragment_size. You can setfragment_sizeto0to never split any sentence.word: Break highlighted fragments at the next word boundary, as determined by Java’sBreakIterator. You can specify the locale to use withboundary_scanner_locale.
-
Values:
charssentenceword -
boundary_scanner_localestring · default: Locale.ROOT -
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". -
fragmenterenum · default: span -
Specifies how text should be broken up in highlight snippets:
simpleorspan. Only valid for theplainhighlighter. -
Values:
simplespan -
highlight_query{} Query -
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.
-
max_analyzed_offsetnumber -
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_offsetquery setting does not override theindex.highlight.max_analyzed_offsetsetting, which prevails when it’s set to lower value than the query setting. -
no_match_sizenumber · default: 0 -
The amount of text you want to return from the beginning of the field if there are no matching fragments to highlight.
-
number_of_fragmentsnumber · default: 5 -
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. Ifnumber_of_fragmentsis0,fragment_sizeis ignored. -
orderenum · default: none -
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 toscorewill output the most relevant fragments first. Each highlighter applies its own logic to compute relevancy scores. -
Values:
score -
phrase_limitnumber · default: 256 -
Controls the number of matching phrases in a document that are considered. Prevents the
fvhhighlighter from analyzing too many phrases and consuming too much memory. When usingmatched_fields,phrase_limitphrases per matched field are considered. Raising the limit increases query time and consumes more memory. Only supported by thefvhhighlighter. -
post_tagsstring[] -
Use in conjunction with
pre_tagsto define the HTML tags to use for the highlighted text. By default, highlighted text is wrapped in<em>and</em>tags. -
pre_tagsstring[] -
Use in conjunction with
post_tagsto define the HTML tags to use for the highlighted text. By default, highlighted text is wrapped in<em>and</em>tags. -
sortunion oneOf -
How the inner hits should be sorted per
inner_hits. By default, inner hits are sorted by score. -
_sourceunion oneOf - One of:
-
explainboolean · default: false -
If true, returns detailed information about score computation as part of a hit.
-
fromnumber · default: 0 -
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.
-
highlightobject -
Same fields as
highlightininner_hits -
track_total_hitsboolean | number -
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.
-
docvalue_fieldsobject[] -
Array of wildcard (*) patterns. The request returns doc values for field names matching these patterns in the hits.fields property of the response.
-
knnunion oneOf -
Defines the approximate kNN search to run.
-
objectorobject[] -
query_vector_builderobject -
The query vector builder. You must provide a query_vector_builder or query_vector, but not both.
-
visit_percentagenumber -
The percentage of vectors to explore per shard while doing knn search with bbq_disk
-
inner_hitsobject -
If defined, each search hit will contain inner hits.
- Reference
-
namestring -
The name for the particular inner hit definition in the response. Useful when a search request contains multiple inner hits.
-
highlightobject -
Same fields as
highlightininner_hits -
sortunion oneOf -
How the inner hits should be sorted per
inner_hits. By default, inner hits are sorted by score. -
Same options as
sortininner_hits -
_sourceunion oneOf - One of:
-
min_scorenumber -
Minimum _score for matching documents. Documents with a lower _score are not included in search results and results collected by aggregations.
-
post_filter{} Query -
query{} Query -
Defines the search definition using the Query DSL.
-
rescoreunion oneOf -
objectorobject[] -
queryobject -
rescore_query{} Queryrequired -
The query to use for rescoring. This query is only run on the Top-K results returned by the
queryandpost_filterphases. -
query_weightnumber · default: 1 -
Relative importance of the original query versus the rescore query.
-
rescore_query_weightnumber · default: 1 -
Relative importance of the rescore query versus the original query.
-
score_modeenum · default: total -
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 forfunctionquery rescores.total: Add the original score and the rescore query score.
-
Values:
avgmaxminmultiplytotal -
script_fieldsmap string to object -
Retrieve a script evaluation (based on different fields) for each hit.
-
sizenumber · default: 10 -
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.
-
sortunion oneOf -
Same options as
sortininner_hits -
_sourceunion oneOf -
Indicates which source fields are returned for matching documents. These fields are returned in the hits._source property of the search response.
- One of:
-
fieldsobject[] -
Array of wildcard (*) patterns. The request returns values for field names matching these patterns in the hits.fields property of the response.
-
terminate_afternumber · default: 0 -
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.
-
timeoutstring -
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_scoresboolean · default: false -
If true, calculate and return document scores, even if the scores are not used for sorting.
-
seq_no_primary_termboolean -
If true, returns sequence number and primary term of the last modification of each hit. See Optimistic concurrency control.
-
stored_fieldsunion oneOf -
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.
-
One of:
string[]orstring
Responses
-
is_partialbooleanrequired -
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_partialis always set totrue. -
is_runningbooleanrequired -
Indicates whether the search is still running or has completed.
NoteIf 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_runningisfalse. -
completion_timeunion oneOf -
Indicates when the async search completed. It is present only when the search has completed.
-
One of:
stringornumber -
responseobjectrequired -
aggregationsmap string to {} Aggregation result -
Partial aggregations results, coming from the shards that have already completed running the query.
-
_clustersobject -
detailsmap string to object -
<string>object -
failuresobject[] -
Same fields as
failuresin_shards -
hitsobjectrequired -
num_reduce_phasesnumber -
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.
-
profileobject -
shardsobject[]required -
aggregationsobject[]required -
childrenobject[] -
Same fields as
aggregationsinshards -
dfsobject -
rescoreunion oneOf[] -
One entry per rescorer, in the order they ran. Omitted when the request has no rescorer.
- One of:
-
time_in_nanosnumberrequired -
The total time spent in the rescorer, including the time spent running its queries.
-
timestring -
The time spent in the rescorer, in human-readable units. Only returned when
humanistrue. -
debugmap string to object -
Extra details about the rescorer.
Every rescorer reports
window_size, the number of top documents it was configured to rescore.timed_outis set totrueif the search timed out while the rescorer was running. Rescorers can add their own keys. -
searchesobject[]required -
queryobject[]required -
debugmap string to object -
Extra details about the query.
Queries run by a rescorer include a
rescorerkey with the position of that rescorer in the shard'srescorearray. -
childrenobject[] -
Same fields as
queryinsearches -
requestobject -
When profiling is enabled, the original query source and target indices from the coordinating request.
-
sourceobject -
Original query source from the search request (
SearchSourceBuilderas JSON). -
aggregationsmap string to {} Aggregation -
Defines the aggregations that are run as part of the search request.
-
explainboolean · default: false -
If
true, the request returns detailed information about score computation as part of a hit. -
fromnumber · default: 0 -
The starting document offset, which must be non-negative. By default, you cannot page through more than 10,000 hits using the
fromandsizeparameters. To page through more hits, use thesearch_afterparameter. -
highlightobject -
Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results.
-
Same fields as
highlightininner_hits - Reference
-
track_total_hitsboolean | 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. Iffalse, the response does not include the total number of hits matching the query. -
indices_booststring to number[] -
Boost the
_scoreof documents from specified indices. The boost value is the factor by which scores are multiplied. A boost value greater than1.0increases the score. A boost value between0and1.0decreases the score. - Reference
-
docvalue_fieldsobject[] -
An array of wildcard (
*) field patterns. The request returns doc values for field names matching these patterns in thehits.fieldsproperty of the response. - Reference
-
rankobject -
The Reciprocal Rank Fusion (RRF) to use.
-
min_scorenumber -
The minimum
_scorefor matching documents. Documents with a lower_scoreare not included in search results or results collected by aggregations. -
post_filter{} Query -
Use the
post_filterparameter to filter search results. The search hits are filtered after the aggregations are calculated. A post filter has no impact on the aggregation results. -
profileboolean · default: false -
Set to
trueto 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. - Reference
-
query{} Query -
The search definition using the Query DSL.
-
rescoreunion oneOf -
Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the
queryandpost_filterphases. -
objectorobject[] -
Same options as
rescore - Reference
-
retrieverobject -
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
queryandknn. - Reference
-
standardobject -
A retriever that replaces the functionality of a traditional query.
-
min_scorenumber -
Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
-
query{} Query -
Defines a query to retrieve a set of top documents.
-
sortunion oneOf -
A sort object that that specifies the order of matching documents.
-
Same options as
sortininner_hits -
collapseobject -
Collapses the top documents by a specified key into a single top document per key.
-
Same fields as
collapse -
knnobject -
A retriever that replaces the functionality of a knn search.
-
min_scorenumber -
Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
-
query_vectornumber[] -
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_builderobject -
Defines a model to build a query vector.
-
Same fields as
query_vector_builderinknn -
rrfobject -
A retriever that produces top documents from reciprocal rank fusion (RRF).
-
min_scorenumber -
Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
-
retrieversunion oneOf[]required -
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.
- One of:
-
text_similarity_rerankerobject -
A retriever that reranks the top documents based on a reranking model using the InferenceAPI
-
min_scorenumber -
Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
-
retrieverobjectrequired -
The nested retriever which will produce the first-level results, that will later be used for reranking.
-
Same fields as
retrieverinsource -
rank_window_sizenumber -
This value determines how many documents we will consider from the nested retriever.
-
fieldstringrequired -
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_rescorerobject -
Whether to rescore on only the best matching chunks.
-
chunking_settingsobject -
Chunking settings to apply
-
max_chunk_sizenumber · default: 250required -
The maximum size of a chunk in words. This value cannot be lower than
20(forsentencestrategy) or10(forwordstrategy). This value should not exceed the window size for the associated model. -
overlapnumber · default: 100 -
The number of overlapping words for chunks. It is applicable only to a
wordchunking strategy. This value cannot be higher than half themax_chunk_sizevalue. -
sentence_overlapnumber · default: 1 -
The number of overlapping sentences for chunks. It is applicable only for a
sentencechunking strategy. It can be either1or0. -
separator_groupstring -
Only applicable to the
recursivestrategy 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
markdownorplaintext.Using this parameter is an alternative to manually specifying a custom
separatorslist. -
separatorsstring[] -
Only applicable to the
recursivestrategy 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_sizelimit, to reduce the total number of chunks generated. -
strategystring · default: sentence -
The chunking strategy:
sentence,word,noneorrecursive.- If
strategyis set torecursive, you must also specify:
max_chunk_size- either
separatorsorseparator_group
Learn more about different chunking strategies in the linked documentation.
- If
- Reference
-
ruleobject -
A retriever that replaces the functionality of a rule query.
-
min_scorenumber -
Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
-
ruleset_idsunion string | string[]required -
The ruleset IDs containing the rules this retriever is evaluating against.
-
match_criteriaobjectrequired -
The match criteria that will determine if a rule in the provided rulesets should be applied.
-
retrieverobjectrequired -
The retriever whose results rules should be applied to.
-
Same fields as
retrieverinsource -
linearobject -
A retriever that supports the combination of different retrievers through a weighted linear combination.
-
pinnedobject -
A pinned retriever applies pinned documents to the underlying retriever. This retriever will rewrite to a PinnedQueryBuilder.
-
diversifyobject -
A retriever that diversifies the results from its child retriever.
-
min_scorenumber -
Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
-
retrieverobjectrequired -
The nested retriever whose results will be diversified.
-
Same fields as
retrieverinsource -
rank_window_sizenumber -
The number of top documents from the nested retriever to consider for diversification.
-
query_vector_builderobject -
a dense vector query vector builder to use instead of a static query_vector
-
Same fields as
query_vector_builderinknn -
script_fieldsmap string to object -
Retrieve a script evaluation (based on different fields) for each hit.
-
search_afterunion[] -
Used to retrieve the next page of hits using a set of sort values from the previous page.
- Reference
-
sizenumber · 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
fromandsizeparameters. To page through more hits, use thesearch_afterproperty. -
sliceobject -
Split a scrolled search into multiple slices that can be consumed independently.
- Reference
-
_sourceunion oneOf -
The source fields that are returned for matching documents. These fields are returned in the
hits._sourceproperty of the search response. If thestored_fieldsproperty is specified, the_sourceproperty defaults tofalse. Otherwise, it defaults totrue. - One of:
- Reference
-
fieldsobject[] -
An array of wildcard (
*) field patterns. The request returns values for field names matching these patterns in thehits.fieldsproperty of the response. -
suggestobject -
Defines a suggester that provides similar looking terms based on a provided text.
- Reference
-
terminate_afternumber · 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.
ImportantUse 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. -
timeoutstring -
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_scoresboolean · default: false -
If
true, calculate and return document scores, even if the scores are not used for sorting. -
versionboolean · default: false -
If
true, the request returns the document version as part of a hit. -
seq_no_primary_termboolean -
If
true, the request returns sequence number and primary term of the last modification of each hit. - Reference
-
stored_fieldsunion oneOf -
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
_sourceproperty defaults tofalse. You can pass_source: trueto return both source fields and stored fields in the search response. -
One of:
string[]orstring - Reference
-
pitobject -
Limit the search to a point in time (PIT). If you provide a PIT, you cannot specify an
<index>in the request path. -
runtime_mappingsobject -
One or more runtime fields in the search request. These fields take precedence over mapped fields with the same name.
- Reference
-
_shardsobjectrequired -
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
_shardsindetails
-
responseobject -
aggregationsmap string to {} Aggregation result -
Partial aggregations results, coming from the shards that have already completed running the query.
-
_clustersobject -
Same fields as
_clustersinresponse -
hitsobjectrequired -
Same fields as
hitsinresponse -
num_reduce_phasesnumber -
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.
-
profileobject -
shardsobject[]required -
aggregationsobject[]required -
breakdownobjectrequired -
Same fields as
breakdowninaggregations -
debugobject -
Same fields as
debuginaggregations -
childrenobject[] -
Same fields as
aggregationsinshards -
fetchobject -
Same fields as
fetchinshards -
rescoreunion oneOf[] -
One entry per rescorer, in the order they ran. Omitted when the request has no rescorer.
-
Same options as
rescoreinshards -
requestobject -
When profiling is enabled, the original query source and target indices from the coordinating request.
-
sourceobject -
Original query source from the search request (
SearchSourceBuilderas JSON). -
aggregationsmap string to {} Aggregation -
Defines the aggregations that are run as part of the search request.
-
explainboolean · default: false -
If
true, the request returns detailed information about score computation as part of a hit. -
fromnumber · default: 0 -
The starting document offset, which must be non-negative. By default, you cannot page through more than 10,000 hits using the
fromandsizeparameters. To page through more hits, use thesearch_afterparameter. -
highlightobject -
Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results.
-
Same fields as
highlightininner_hits - Reference
-
track_total_hitsboolean | 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. Iffalse, the response does not include the total number of hits matching the query. -
indices_booststring to number[] -
Boost the
_scoreof documents from specified indices. The boost value is the factor by which scores are multiplied. A boost value greater than1.0increases the score. A boost value between0and1.0decreases the score. - Reference
-
docvalue_fieldsobject[] -
An array of wildcard (
*) field patterns. The request returns doc values for field names matching these patterns in thehits.fieldsproperty of the response. - Reference
-
rankobject -
The Reciprocal Rank Fusion (RRF) to use.
-
min_scorenumber -
The minimum
_scorefor matching documents. Documents with a lower_scoreare not included in search results or results collected by aggregations. -
post_filter{} Query -
Use the
post_filterparameter to filter search results. The search hits are filtered after the aggregations are calculated. A post filter has no impact on the aggregation results. -
profileboolean · default: false -
Set to
trueto 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. - Reference
-
query{} Query -
The search definition using the Query DSL.
-
rescoreunion oneOf -
Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the
queryandpost_filterphases. -
objectorobject[] -
Same options as
rescore - Reference
-
retrieverobject -
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
queryandknn. -
Same fields as
retrieverinsource - Reference
-
script_fieldsmap string to object -
Retrieve a script evaluation (based on different fields) for each hit.
-
search_afterunion[] -
Used to retrieve the next page of hits using a set of sort values from the previous page.
- Reference
-
sizenumber · 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
fromandsizeparameters. To page through more hits, use thesearch_afterproperty. -
sliceobject -
Split a scrolled search into multiple slices that can be consumed independently.
- Reference
-
_sourceunion oneOf -
The source fields that are returned for matching documents. These fields are returned in the
hits._sourceproperty of the search response. If thestored_fieldsproperty is specified, the_sourceproperty defaults tofalse. Otherwise, it defaults totrue. - One of:
- Reference
-
fieldsobject[] -
An array of wildcard (
*) field patterns. The request returns values for field names matching these patterns in thehits.fieldsproperty of the response. -
suggestobject -
Defines a suggester that provides similar looking terms based on a provided text.
- Reference
-
terminate_afternumber · 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.
ImportantUse 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. -
timeoutstring -
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_scoresboolean · default: false -
If
true, calculate and return document scores, even if the scores are not used for sorting. -
versionboolean · default: false -
If
true, the request returns the document version as part of a hit. -
seq_no_primary_termboolean -
If
true, the request returns sequence number and primary term of the last modification of each hit. - Reference
-
stored_fieldsunion oneOf -
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
_sourceproperty defaults tofalse. You can pass_source: trueto return both source fields and stored fields in the search response. -
One of:
string[]orstring - Reference
-
pitobject -
Limit the search to a point in time (PIT). If you provide a PIT, you cannot specify an
<index>in the request path. -
runtime_mappingsobject -
One or more runtime fields in the search request. These fields take precedence over mapped fields with the same name.
- Reference
-
_shardsobjectrequired -
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
_shardsindetails