Run multiple searches
- POST also GET /{index}/_msearch
- POST also GET /_msearch
The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. The structure is as follows:
header\n
body\n
header\n
body\n
This structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node.
The final line of data must end with a newline character \n.
Each newline character may be preceded by a carriage return \r.
When sending requests to this endpoint the Content-Type header should be set to application/x-ndjson.
Required authorization
- Index privileges read
Authentication
Authorization: <value>
Elasticsearch APIs support key-based authentication. You must create an API key and use the encoded value in the request header. For example:
curl -X GET "${ES_URL}/_cat/indices?v=true" \
-H "Authorization: ApiKey ${API_KEY}"
To get API keys, use the /_security/api_key APIs.
Authorization: Basic <credentials>
Authorization: Bearer <token>
Elasticsearch APIs support the use of bearer tokens in the Authorization HTTP header to authenticate with the API.
For examples, refer to Token-based authentication services
Query parameters
-
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. -
ccs_minimize_roundtripsboolean · default: true -
If true, network roundtrips between the coordinating node and remote clusters are minimized for cross-cluster search requests.
-
expand_wildcardsstring · default: open -
Type of index that wildcard expressions can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.
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 -
ignore_throttledboolean · default: falsedeprecated -
If true, concrete, expanded or aliased indices are ignored when frozen.
-
ignore_unavailableboolean · default: false -
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. -
include_named_queries_scoreboolean · default: false -
Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false) This functionality reruns each named query on every hit in a search response. Typically, this adds a small overhead to a request. However, using computationally expensive named queries on a large number of hits may add significant overhead.
-
indexunion oneOf -
Comma-separated list of data streams, indices, and index aliases to use as default
-
One of:
string[]orstring -
max_concurrent_searchesnumber -
Maximum number of concurrent searches the multi search API can execute. Defaults to
max(1, (# of data nodes * min(search thread pool size, 10))). -
max_concurrent_shard_requestsnumber · default: 5 -
Maximum number of concurrent shard requests that each sub-search request executes per node.
-
pre_filter_shard_sizenumber -
Defines a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method i.e., if date filters are mandatory to match but the shard bounds and the query are disjoint.
-
rest_total_hits_as_intboolean · default: false -
If true, hits.total are returned as an integer in the response. Defaults to false, which returns an object.
-
routingunion oneOf -
Custom routing value used to route search operations to a specific shard. Not allowed when
index.slice.enabledistruefor the target index; use_sliceinstead. -
One of:
string[]orstring -
search_typeenum -
Indicates whether global term and document frequencies should be used when scoring returned documents.
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
Request body
Contains parameters used to limit or change the subsequent search body request.
-
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. -
expand_wildcardsstring -
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 -
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. -
routingstring -
A custom value used to route operations to a specific shard. Not allowed when
index.slice.enabledistruefor the target index; use_sliceinstead. -
search_typeenum -
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
-
aggregationsmap string to {} Aggregation -
Defines the aggregations that are run as part of the search request.
-
collapseobject -
Collapses search results the values of the specified field.
-
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
collapsein{ aggregations, collapse, explain, … } -
highlightobject -
typeunion -
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. -
max_concurrent_group_searchesnumber -
The number of concurrent requests allowed to retrieve the inner_hits per group
-
collapseobject -
Same fields as
collapsein{ aggregations, collapse, explain, … } -
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
-
knnunion oneOf -
The approximate kNN search to run.
-
objectorobject[] - Reference
-
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.
-
collapseobject -
max_concurrent_group_searchesnumber -
The number of concurrent requests allowed to retrieve the inner_hits per group
-
collapseobject -
Same fields as
collapseininner_hits -
highlightobject -
Same fields as
highlightininner_hits -
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[] - Reference
-
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 -
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.
-
collapseobject -
Collapses the top documents by a specified key into a single top document per key.
-
Same fields as
collapsein{ aggregations, collapse, explain, … } -
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
retrieverin{ aggregations, collapse, explain, … } -
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
retrieverin{ aggregations, collapse, explain, … } -
rescorerobject -
A retriever that re-scores only the results produced by its child retriever.
-
min_scorenumber -
Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
-
retrieverobjectrequired -
Inner retriever.
-
Same fields as
retrieverin{ aggregations, collapse, explain, … } -
rescoreunion oneOfrequired -
objectorobject[] -
Same options as
rescorein{ aggregations, collapse, explain, … } -
linearobject -
A retriever that supports the combination of different retrievers through a weighted linear combination.
-
min_scorenumber -
Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
-
retrieversobject[] -
Inner retrievers.
-
retrieverobjectrequired -
The nested retriever configuration.
-
Same fields as
retrieverin{ aggregations, collapse, explain, … } -
pinnedobject -
A pinned retriever applies pinned documents to the underlying retriever. This retriever will rewrite to a PinnedQueryBuilder.
-
min_scorenumber -
Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
-
retrieverobjectrequired -
Inner retriever.
-
Same fields as
retrieverin{ aggregations, collapse, explain, … } -
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
retrieverin{ aggregations, collapse, explain, … } -
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 -
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. - 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_fieldsstring -
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. - 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
Response
-
responsesunion oneOf[]required - One of:
-
tooknumberrequired -
The number of milliseconds it took Elasticsearch to run the request. This value is calculated by measuring the time elapsed between receipt of a request on the coordinating node and the time at which the coordinating node is ready to send the response. It includes:
- Communication time between the coordinating node and data nodes
- Time the request spends in the search thread pool, queued for execution
- Actual run time
It does not include:
- Time needed to send the request to Elasticsearch
- Time needed to serialize the JSON response
- Time needed to send the response to a client
-
timed_outbooleanrequired -
If
true, the request timed out before completion; returned results may be partial or empty. -
hitsobjectrequired -
The returned documents and metadata.
-
aggregationsmap string to {} Aggregation result -
profileobject -
shardsobject[]required -
aggregationsobject[]required -
childrenobject[] -
Same fields as
aggregationsinshards -
dfsobject -
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.
-
collapseobject -
Collapses search results the values of the specified field.
-
Same fields as
collapsein{ aggregations, collapse, explain, … } -
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
-
knnunion oneOf -
The approximate kNN search to run.
-
objectorobject[] -
Same options as
knnin{ aggregations, collapse, explain, … } - 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
rescorein{ aggregations, collapse, explain, … } - 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
retrieverin{ aggregations, collapse, explain, … } - 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 -
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. - 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_fieldsstring -
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. - 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
-
pit_idstring -
An updated identifier for the point-in-time that was searched.
ImportantEach search request against a PIT returns in its response a
pit_idfield which may be different from the identifier you originally supplied. Always use the most recently-received PIT identifier for the next request. If you make concurrent search requests against the same PIT, Elasticsearch can return several differentpit_idvalues in its responses. In that case, use any of these values for later requests, preferring more recently-received values whenever possible. -
_scroll_idstring -
The identifier for the search and its search context. You can use this scroll ID with the scroll API to retrieve the next batch of search results for the request. This property is returned only if the
scrollquery parameter is specified in the request. - Reference
The response returned by Elasticsearch when request execution did not succeed.