|
@@ -38,6 +38,10 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index]
|
|
[[search-search-api-query-params]]
|
|
[[search-search-api-query-params]]
|
|
==== {api-query-parms-title}
|
|
==== {api-query-parms-title}
|
|
|
|
|
|
|
|
+IMPORTANT: Several options for this API can be specified using a query parameter
|
|
|
|
+or a request body parameter. If both parameters are specified, only the query
|
|
|
|
+parameter is used.
|
|
|
|
+
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=allow-no-indices]
|
|
+
|
|
+
|
|
Defaults to `true`.
|
|
Defaults to `true`.
|
|
@@ -75,14 +79,6 @@ Defaults to `open`.
|
|
`explain`::
|
|
`explain`::
|
|
(Optional, boolean) If `true`, returns detailed information about score
|
|
(Optional, boolean) If `true`, returns detailed information about score
|
|
computation as part of a hit. Defaults to `false`.
|
|
computation as part of a hit. Defaults to `false`.
|
|
-+
|
|
|
|
---
|
|
|
|
-[IMPORTANT]
|
|
|
|
-====
|
|
|
|
-You can also specify this value using the `explain` request body parameter. If
|
|
|
|
-both parameters are specified, only the query parameter is used.
|
|
|
|
-====
|
|
|
|
---
|
|
|
|
|
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=from]
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=from]
|
|
+
|
|
+
|
|
@@ -100,12 +96,6 @@ correct.
|
|
As an alternative to deep paging, we recommend using
|
|
As an alternative to deep paging, we recommend using
|
|
<<request-body-search-scroll,scroll>> or the
|
|
<<request-body-search-scroll,scroll>> or the
|
|
<<request-body-search-search-after,`search_after`>> parameter.
|
|
<<request-body-search-search-after,`search_after`>> parameter.
|
|
-
|
|
|
|
-[IMPORTANT]
|
|
|
|
-====
|
|
|
|
-You can also specify this value using the `from` request body parameter. If
|
|
|
|
-both parameters are specified, only the query parameter is used.
|
|
|
|
-====
|
|
|
|
--
|
|
--
|
|
|
|
|
|
`ignore_throttled`::
|
|
`ignore_throttled`::
|
|
@@ -139,18 +129,14 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailab
|
|
[[search-api-query-params-q]]
|
|
[[search-api-query-params-q]]
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=search-q]
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=search-q]
|
|
+
|
|
+
|
|
---
|
|
|
|
You can use the `q` parameter to run a query parameter search. Query parameter
|
|
You can use the `q` parameter to run a query parameter search. Query parameter
|
|
searches do not support the full {es} <<query-dsl,Query DSL>> but are handy for
|
|
searches do not support the full {es} <<query-dsl,Query DSL>> but are handy for
|
|
testing.
|
|
testing.
|
|
-
|
|
|
|
-[IMPORTANT]
|
|
|
|
-====
|
|
|
|
-The `q` parameter overrides the <<request-body-search-query,`query`>>
|
|
|
|
|
|
++
|
|
|
|
+IMPORTANT: The `q` parameter overrides the <<request-body-search-query,`query`>>
|
|
parameter in the request body. If both parameters are specified, documents
|
|
parameter in the request body. If both parameters are specified, documents
|
|
-matching the `query` request body parameter are not returned.
|
|
|
|
-====
|
|
|
|
---
|
|
|
|
|
|
+matching the `query` request body parameter are not returned.
|
|
|
|
+
|
|
|
|
|
|
`request_cache`::
|
|
`request_cache`::
|
|
(Optional, boolean) If `true`, the caching of search results is enabled for
|
|
(Optional, boolean) If `true`, the caching of search results is enabled for
|
|
@@ -177,18 +163,9 @@ this limit using the `search.max_keep_alive` cluster-level setting.
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=search_type]
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=search_type]
|
|
|
|
|
|
`seq_no_primary_term`::
|
|
`seq_no_primary_term`::
|
|
-+
|
|
|
|
---
|
|
|
|
(Optional, boolean) If `true`, returns sequence number and primary term of the
|
|
(Optional, boolean) If `true`, returns sequence number and primary term of the
|
|
last modification of each hit. See <<optimistic-concurrency-control>>.
|
|
last modification of each hit. See <<optimistic-concurrency-control>>.
|
|
|
|
|
|
-[IMPORTANT]
|
|
|
|
-====
|
|
|
|
-You can also specify this value using the `seq_no_primary_term` request body
|
|
|
|
-parameter. If both parameters are specified, only the query parameter is used.
|
|
|
|
-====
|
|
|
|
---
|
|
|
|
-
|
|
|
|
`size`::
|
|
`size`::
|
|
(Optional, integer) Defines the number of hits to return. Defaults to `10`.
|
|
(Optional, integer) Defines the number of hits to return. Defaults to `10`.
|
|
+
|
|
+
|
|
@@ -208,13 +185,7 @@ As an alternative to deep paging, we recommend using
|
|
<<request-body-search-search-after,`search_after`>> parameter.
|
|
<<request-body-search-search-after,`search_after`>> parameter.
|
|
|
|
|
|
If the <<search-api-scroll-query-param,`scroll` parameter>> is specified, this
|
|
If the <<search-api-scroll-query-param,`scroll` parameter>> is specified, this
|
|
-value cannot be zero (`0`).
|
|
|
|
-
|
|
|
|
-[IMPORTANT]
|
|
|
|
-====
|
|
|
|
-You can also specify this value using the `size` request body parameter. If
|
|
|
|
-both parameters are specified, only the query parameter is used.
|
|
|
|
-====
|
|
|
|
|
|
+value cannot be `0`.
|
|
--
|
|
--
|
|
|
|
|
|
`sort`::
|
|
`sort`::
|
|
@@ -247,30 +218,13 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=source_includes]
|
|
|
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=terminate_after]
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=terminate_after]
|
|
+
|
|
+
|
|
---
|
|
|
|
Defaults to `0`, which does not terminate query execution early.
|
|
Defaults to `0`, which does not terminate query execution early.
|
|
|
|
|
|
-[IMPORTANT]
|
|
|
|
-====
|
|
|
|
-You can also specify this value using the `terminate_after` request body
|
|
|
|
-parameter. If both parameters are specified, only the query parameter is used.
|
|
|
|
-====
|
|
|
|
---
|
|
|
|
-
|
|
|
|
`timeout`::
|
|
`timeout`::
|
|
-+
|
|
|
|
---
|
|
|
|
(Optional, <<time-units, time units>>) Specifies the period of time to wait
|
|
(Optional, <<time-units, time units>>) Specifies the period of time to wait
|
|
for a response. If no response is received before the timeout expires, the
|
|
for a response. If no response is received before the timeout expires, the
|
|
request fails and returns an error. Defaults to no timeout.
|
|
request fails and returns an error. Defaults to no timeout.
|
|
|
|
|
|
-[IMPORTANT]
|
|
|
|
-====
|
|
|
|
-You can also specify this value using the `timeout` request body
|
|
|
|
-parameter. If both parameters are specified, only the query parameter is used.
|
|
|
|
-====
|
|
|
|
---
|
|
|
|
-
|
|
|
|
`track_scores`::
|
|
`track_scores`::
|
|
(Optional, boolean) If `true`, calculate and return document scores, even if
|
|
(Optional, boolean) If `true`, calculate and return document scores, even if
|
|
the scores are not used for sorting. Defaults to `false`.
|
|
the scores are not used for sorting. Defaults to `false`.
|
|
@@ -287,19 +241,9 @@ include the total number of hits matching the query.
|
|
by their respective types in the response. Defaults to `true`.
|
|
by their respective types in the response. Defaults to `true`.
|
|
|
|
|
|
`version`::
|
|
`version`::
|
|
-+
|
|
|
|
---
|
|
|
|
(Optional, boolean)
|
|
(Optional, boolean)
|
|
If `true`, returns document version as part of a hit. Defaults to `false`.
|
|
If `true`, returns document version as part of a hit. Defaults to `false`.
|
|
|
|
|
|
-[IMPORTANT]
|
|
|
|
-====
|
|
|
|
-You can also specify this value using the `version` request body parameter. If
|
|
|
|
-both parameters are specified, only the query parameter is used.
|
|
|
|
-====
|
|
|
|
---
|
|
|
|
-
|
|
|
|
-
|
|
|
|
[[search-search-api-request-body]]
|
|
[[search-search-api-request-body]]
|
|
==== {api-request-body-title}
|
|
==== {api-request-body-title}
|
|
|
|
|
|
@@ -307,14 +251,6 @@ both parameters are specified, only the query parameter is used.
|
|
`explain`::
|
|
`explain`::
|
|
(Optional, boolean) If `true`, returns detailed information about score
|
|
(Optional, boolean) If `true`, returns detailed information about score
|
|
computation as part of a hit. Defaults to `false`.
|
|
computation as part of a hit. Defaults to `false`.
|
|
-+
|
|
|
|
---
|
|
|
|
-[IMPORTANT]
|
|
|
|
-====
|
|
|
|
-You can also specify this value using the `explain` query parameter. If
|
|
|
|
-both parameters are specified, only the query parameter is used.
|
|
|
|
-====
|
|
|
|
---
|
|
|
|
|
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=from]
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=from]
|
|
+
|
|
+
|
|
@@ -332,12 +268,6 @@ correct.
|
|
As an alternative to deep paging, we recommend using
|
|
As an alternative to deep paging, we recommend using
|
|
<<request-body-search-scroll,scroll>> or the
|
|
<<request-body-search-scroll,scroll>> or the
|
|
<<request-body-search-search-after,`search_after`>> parameter.
|
|
<<request-body-search-search-after,`search_after`>> parameter.
|
|
-
|
|
|
|
-[IMPORTANT]
|
|
|
|
-====
|
|
|
|
-You can also specify this value using the `from` query parameter. If both
|
|
|
|
-parameters are specified, only the query parameter is used.
|
|
|
|
-====
|
|
|
|
--
|
|
--
|
|
|
|
|
|
[[request-body-search-query]]
|
|
[[request-body-search-query]]
|
|
@@ -347,18 +277,9 @@ parameters are specified, only the query parameter is used.
|
|
|
|
|
|
[[request-body-search-seq-no-primary-term]]
|
|
[[request-body-search-seq-no-primary-term]]
|
|
`seq_no_primary_term`::
|
|
`seq_no_primary_term`::
|
|
-+
|
|
|
|
---
|
|
|
|
(Optional, boolean) If `true`, returns sequence number and primary term of the
|
|
(Optional, boolean) If `true`, returns sequence number and primary term of the
|
|
last modification of each hit. See <<optimistic-concurrency-control>>.
|
|
last modification of each hit. See <<optimistic-concurrency-control>>.
|
|
|
|
|
|
-[IMPORTANT]
|
|
|
|
-====
|
|
|
|
-You can also specify this value using the `seq_no_primary_term` query parameter.
|
|
|
|
-If both parameters are specified, only the query parameter is used.
|
|
|
|
-====
|
|
|
|
---
|
|
|
|
-
|
|
|
|
`size`::
|
|
`size`::
|
|
(Optional, integer) The number of hits to return. Needs to be non-negative and defaults to `10`.
|
|
(Optional, integer) The number of hits to return. Needs to be non-negative and defaults to `10`.
|
|
+
|
|
+
|
|
@@ -378,55 +299,23 @@ As an alternative to deep paging, we recommend using
|
|
<<request-body-search-search-after,`search_after`>> parameter.
|
|
<<request-body-search-search-after,`search_after`>> parameter.
|
|
|
|
|
|
If the <<search-api-scroll-query-param,`scroll` parameter>> is specified, this
|
|
If the <<search-api-scroll-query-param,`scroll` parameter>> is specified, this
|
|
-value cannot be zero (`0`).
|
|
|
|
-
|
|
|
|
-[IMPORTANT]
|
|
|
|
-====
|
|
|
|
-You can also specify this value using the `size` query parameter. If both
|
|
|
|
-parameters are specified, only the query parameter is used.
|
|
|
|
-====
|
|
|
|
|
|
+value cannot be `0`.
|
|
--
|
|
--
|
|
|
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=terminate_after]
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=terminate_after]
|
|
+
|
|
+
|
|
---
|
|
|
|
Defaults to `0`, which does not terminate query execution early.
|
|
Defaults to `0`, which does not terminate query execution early.
|
|
|
|
|
|
-[IMPORTANT]
|
|
|
|
-====
|
|
|
|
-You can also specify this value using the `terminate_after` query parameter. If
|
|
|
|
-both parameters are specified, only the query parameter is used.
|
|
|
|
-====
|
|
|
|
---
|
|
|
|
-
|
|
|
|
`timeout`::
|
|
`timeout`::
|
|
-+
|
|
|
|
---
|
|
|
|
(Optional, <<time-units, time units>>) Specifies the period of time to wait
|
|
(Optional, <<time-units, time units>>) Specifies the period of time to wait
|
|
for a response. If no response is received before the timeout expires, the
|
|
for a response. If no response is received before the timeout expires, the
|
|
request fails and returns an error. Defaults to no timeout.
|
|
request fails and returns an error. Defaults to no timeout.
|
|
|
|
|
|
-[IMPORTANT]
|
|
|
|
-====
|
|
|
|
-You can also specify this value using the `timeout` query parameter. If both
|
|
|
|
-parameters are specified, only the query parameter is used.
|
|
|
|
-====
|
|
|
|
---
|
|
|
|
-
|
|
|
|
[[request-body-search-version]]
|
|
[[request-body-search-version]]
|
|
`version`::
|
|
`version`::
|
|
-+
|
|
|
|
---
|
|
|
|
(Optional, boolean)
|
|
(Optional, boolean)
|
|
If `true`, returns document version as part of a hit. Defaults to `false`.
|
|
If `true`, returns document version as part of a hit. Defaults to `false`.
|
|
|
|
|
|
-[IMPORTANT]
|
|
|
|
-====
|
|
|
|
-You can also specify this value using the `version` query parameter. If both
|
|
|
|
-parameters are specified, only the query parameter is used.
|
|
|
|
-====
|
|
|
|
---
|
|
|
|
-
|
|
|
|
|
|
|
|
[role="child_attributes"]
|
|
[role="child_attributes"]
|
|
[[search-api-response-body]]
|
|
[[search-api-response-body]]
|