Query parameters
-
If
false, the request returns an error if any wildcard expression, index alias, or_allvalue targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targetingfoo*,bar*returns an error if an index starts withfoobut no index starts withbar. -
If
true, network round-trips are minimized for cross-cluster search requests. -
The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as
open,hidden.Values are
all,open,closed,hidden, ornone. -
If
true, the response includes additional details about score computation as part of a hit. -
If
true, specified concrete, expanded, or aliased indices are not included in the response when throttled. -
The node or shard the operation should be performed on. It is random by default.
-
If
true, the query execution is profiled. -
A custom value used to route operations to a specific shard.
-
Specifies how long a consistent view of the index should be maintained for scrolled search.
Values are
-1or0.External documentation -
The type of the search operation.
Values are
query_then_fetchordfs_query_then_fetch. -
If
true,hits.totalis rendered as an integer in the response. Iffalse, it is rendered as an object. -
If
true, the response prefixes aggregation and suggester names with their respective types.
Body
Required
-
If
true, returns detailed information about score calculation as part of each hit. If you specify both this and theexplainquery parameter, the API uses only the query parameter.Default value is
false. -
The ID of the search template to use. If no
sourceis specified, this parameter is required. -
Key-value pairs used to replace Mustache variables in the template. The key is the variable name. The value is the variable value.
-
If
true, the query execution is profiled.Default value is
false. -
An inline search template. Supports the same parameters as the search API's request body. It also supports Mustache variables. If no
idis specified, this parameter is required.
curl \
--request GET 'http://api.example.com/_search/template' \
--header "Content-Type: application/json" \
--data '"{\n \"id\": \"my-search-template\",\n \"params\": {\n \"query_string\": \"hello world\",\n \"from\": 0,\n \"size\": 10\n }\n}"'
{
"id": "my-search-template",
"params": {
"query_string": "hello world",
"from": 0,
"size": 10
}
}