Menu
Run a search (GET /{index}/_search)
Run a search
/{index}/_searchUse it in a workflow
- Add a step and choose the Elasticsearch connector.
- Pick the Run a search (GET /{index}/_search) action (under search).
- Fill in the fields below, then reference the result from later steps as
{{runASearchGetIndexSearch.response.data}}.
Request
Path parameters
indexoneOfrequiredA comma-separated list of data streams, indices, and aliases to search. It supports wildcards (`*`). To search all data streams and indices, omit this parameter or use `*` or `_all`.
Query parameters
allow_no_indicesbooleanA 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_resultsbooleanIf `true` and there are shard request timeouts or shard failures, the request returns partial results. If `false`, it returns an error with no partial results. To override the default behavior, you can set the `search.default_allow_partial_results` cluster setting to `false`.
analyzerstringThe analyzer to use for the query string. This parameter can be used only when the `q` query string parameter is specified.
analyze_wildcardbooleanIf `true`, wildcard and prefix queries are analyzed. This parameter can be used only when the `q` query string parameter is specified.
batched_reduce_sizenumberThe number of shard results that should be reduced at once on the coordinating node. If the potential number of shards in the request can be large, this value should be used as a protection mechanism to reduce the memory overhead per search request.
ccs_minimize_roundtripsbooleanIf `true`, network round-trips between the coordinating node and the remote clusters are minimized when running cross-cluster search (CCS) requests.
default_operatorstringThe default operator for the query string query: `and` or `or`. This parameter can be used only when the `q` query string parameter is specified.
One ofandANDorOR
dfstringThe field to use as a default when no field prefix is given in the query string. This parameter can be used only when the `q` query string parameter is specified.
docvalue_fieldsoneOfA comma-separated list of fields to return as the docvalue representation of a field for each hit.
expand_wildcardsoneOfThe 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. It supports comma-separated values such as `open,hidden`.
explainbooleanIf `true`, the request returns detailed information about score computation as part of a hit.
ignore_throttledbooleanIf `true`, concrete, expanded or aliased indices will be ignored when frozen.
ignore_unavailablebooleanIf `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.
include_named_queries_scorebooleanIf `true`, the response includes the score contribution from any named queries. 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.
lenientbooleanIf `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. This parameter can be used only when the `q` query string parameter is specified.
max_concurrent_shard_requestsnumberThe number of concurrent shard requests per node that the search runs 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.
preferencestringThe nodes and shards used for the search. By default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, accounting for allocation awareness. Valid values are: * `_only_local` to run the search only on shards on the local node. * `_local` to, if possible, run the search on shards on the local node, or if not, select shards using the default method. * `_only_nodes:<node-id>,<node-id>` to run the search on only the specified nodes IDs. If suitable shards exist on more than one selected node, use shards on those nodes using the default method. If none of the specified nodes are available, select shards from any available node using the default method. * `_prefer_nodes:<node-id>,<node-id>` to if possible, run the search on the specified nodes IDs. If not, select shards using the default method. * `_shards:<shard>,<shard>` to run the search only on the specified shards. You can combine this value with other `preference` values. However, the `_shards` value must come first. For example: `_shards:2,3|_local`. * `<custom-string>` (any string that does not start with `_`) to route searches with the same `<custom-string>` to the same shards in the same order.
pre_filter_shard_sizenumberA 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 (if date filters are mandatory to match but the shard bounds and the query are disjoint). When unspecified, the pre-filter phase is executed if any of these conditions is met: * The request targets more than 128 shards. * The request targets one or more read-only index. * The primary sort of the query targets an indexed field.
request_cachebooleanIf `true`, the caching of search results is enabled for requests where `size` is `0`. It defaults to index level settings.
routingoneOfA custom value that is used to route operations to a specific shard.
scrolloneOfThe period to retain the search context for scrolling. By default, this value cannot exceed `1d` (24 hours). You can change this limit by using the `search.max_keep_alive` cluster-level setting.
search_typestringIndicates how distributed term frequencies are calculated for relevance scoring.
One ofquery_then_fetchdfs_query_then_fetch
statsoneOfSpecific `tag` of the request for logging and statistical purposes.
stored_fieldsoneOfA 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` parameter defaults to `false`. You can pass `_source: true` to return both source fields and stored fields in the search response.
suggest_fieldstringThe field to use for suggestions.
suggest_modestringThe suggest mode. This parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified.
One ofmissingpopularalways
suggest_sizenumberThe number of suggestions to return. This parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified.
suggest_textstringThe source text for which the suggestions should be returned. This parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified.
terminate_afternumberThe 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 parameter to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. If set to `0` (default), the query does not terminate early.
timeoutoneOfThe 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. It defaults to no timeout.
track_total_hitsoneOfThe 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.
track_scoresbooleanIf `true`, the request calculates and returns document scores, even if the scores are not used for sorting.
typed_keysbooleanIf `true`, aggregation and suggester names are be prefixed by their respective types in the response.
rest_total_hits_as_intbooleanIndicates whether `hits.total` should be rendered as an integer or an object in the rest search response.
versionbooleanIf `true`, the request returns the document version as part of a hit.
_sourceoneOfThe source fields that are returned for matching documents. These fields are returned in the `hits._source` property of the search response. Valid values are: * `true` to return the entire document source. * `false` to not return the document source. * `<string>` to return the source fields that are specified as a comma-separated list that supports wildcard (`*`) patterns.
_source_excludesoneOfA comma-separated list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. If the `_source` parameter is `false`, this parameter is ignored.
_source_exclude_vectorsbooleanWhether vectors should be excluded from _source
_source_includesoneOfA comma-separated list of source fields to include in the response. If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the `_source_excludes` query parameter. If the `_source` parameter is `false`, this parameter is ignored.
seq_no_primary_termbooleanIf `true`, the request returns the sequence number and primary term of the last modification of each hit.
qstringA query in the Lucene query string syntax. Query parameter searches do not support the full Elasticsearch Query DSL but are handy for testing. IMPORTANT: This parameter overrides the query parameter in the request body. If both parameters are specified, documents matching the query request body parameter are not returned.
sizenumberThe 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.
fromnumberThe 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.
sortoneOfA comma-separated list of `<field>:<direction>` pairs.
Response
Returns 200 with an object. Read it in later steps with {{runASearchGetIndexSearch.response.data.<field>}}.
tooknumberThe 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_outbooleanIf `true`, the request timed out before completion; returned results may be partial or empty.
_shardsanyA count of shards used for the request.
hitsanyThe returned documents and metadata.
aggregationsobject_clustersanyfieldsobjectmax_scorenumbernum_reduce_phasesnumberprofileanypit_idany_scroll_idanyThe 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 `scroll` query parameter is specified in the request.
suggestobjectterminated_earlyboolean{
"took": 0,
"timed_out": false,
"_shards": null,
"hits": null,
"aggregations": {},
"_clusters": null,
"fields": {},
"max_score": 0,
"num_reduce_phases": 0,
"profile": null,
"pit_id": null,
"_scroll_id": null
}
Need more? See the Elasticsearch guide for connection setup and behaviour shared by every action.