[DOCS] Remove search request body page (#60972) (#60977)

This commit is contained in:
James Rodewig 2020-08-11 13:04:07 -04:00 committed by GitHub
parent 4bdf283619
commit 929f1cc9f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 135 additions and 241 deletions

View File

@ -65,7 +65,7 @@ include-tagged::{doc-tests-file}[{api}-request-item-extras]
<2> Version
<3> Version type
{ref}/search-request-body.html#request-body-search-preference[`preference`],
{ref}/search-your-data.html#search-preference[`preference`],
{ref}/docs-get.html#realtime[`realtime`]
and
{ref}/docs-get.html#get-refresh[`refresh`] can be set on the main request but

View File

@ -29,7 +29,7 @@ are different too.
The recommended way to work around this issue is to use a string that identifies
the user that is logged is (a user id or session id for instance) as a
<<request-body-search-preference,preference>>. This ensures that all queries of a
<<search-preference,preference>>. This ensures that all queries of a
given user are always going to hit the same shards, so scores remain more
consistent across queries.

View File

@ -75,7 +75,7 @@ See <<highlighting>>.
[role="exclude",id="search-request-index-boost"]
=== Index boost parameter for request body search API
See <<request-body-search-index-boost>>.
See <<index-boost>>.
[role="exclude",id="search-request-inner-hits"]
=== Inner hits parameter for request body search API
@ -95,7 +95,7 @@ See <<post-filter>>.
[role="exclude",id="search-request-preference"]
=== Preference parameter for request body search API
See <<request-body-search-preference>>.
See <<search-preference>>.
[role="exclude",id="search-request-query"]
=== Query parameter for request body search API
@ -103,7 +103,7 @@ See <<request-body-search-query>>.
[role="exclude",id="search-request-rescore"]
=== Rescoring parameter for request body search API
See <<request-body-search-rescore>>.
See <<rescore>>.
[role="exclude",id="search-request-script-fields"]
=== Script fields parameter for request body search API
@ -119,11 +119,11 @@ See <<search-after>>.
[role="exclude",id="search-request-search-type"]
=== Search type parameter for request body search API
See <<request-body-search-search-type>>.
See <<search-type>>.
[role="exclude",id="search-request-seq-no-primary-term"]
=== Sequence numbers and primary terms parameter for request body search API
See <<request-body-search-search-type>>.
See <<optimistic-concurrency-control>>.
[role="exclude",id="search-request-sort"]
=== Sort parameter for request body search API
@ -140,7 +140,7 @@ See <<stored-fields>>.
[role="exclude",id="search-request-track-total-hits"]
=== Track total hits parameter for request body search API
See <<request-body-search-track-total-hits>>.
See <<track-total-hits>>.
[role="exclude",id="search-request-version"]
=== Version parameter for request body search API
@ -974,7 +974,6 @@ See <<eql-syntax-limitations>>.
See <<eql-required-fields>>.
////
[role="exclude",id="search-request-body"]
=== Request body search
@ -982,13 +981,18 @@ This page has been removed.
For search API reference documentation, see <<search-search>>.
For search examples, see <<run-a-search>>.
For search examples, see <<search-your-data>>.
[role="exclude",id="request-body-search-docvalue-fields"]
==== Doc value fields
See <<docvalue-fields, doc value fields>>.
[role="exclude",id="_fast_check_for_any_matching_docs"]
==== Fast check for any matching docs
See <<quickly-check-for-matching-docs>>.
[role="exclude",id="request-body-search-collapse"]
==== Field collapsing
@ -1009,26 +1013,36 @@ See <<highlighting>>.
See <<how-es-highlighters-work-internally>>.
[role="exclude",id="request-body-search-index-boost"]
==== Index boost
See <<index-boost>>.
[role="exclude",id="request-body-search-inner-hits"]
=== Inner hits
==== Inner hits
See <<inner-hits>>.
[role="exclude",id="request-body-search-min-score"]
=== `min_score`
See <<search-api-min-score>>.
==== `min_score`
See the <<search-api-min-score,`min_score`>> parameter.
[role="exclude",id="request-body-search-queries-and-filters"]
=== Named queries
==== Named queries
See <<named-queries>.
See <<named-queries>>.
[role="exclude",id="request-body-search-post-filter"]
=== Post filter
==== Post filter
See <<post-filter>>.
[role="exclude",id="request-body-search-preference"]
==== Preference
See <<search-preference>>.
[role="exclude",id="request-body-search-rescore"]
=== Rescoring
==== Rescoring
See <<rescore>>.
@ -1043,12 +1057,12 @@ See <<script-fields>>.
See <<scroll-search-results>>.
[[_clear_scroll_api]]
===== Clear scroll API
==== Clear scroll API
See <<clear-scroll-api>>.
[[sliced-scroll]]
===== Sliced scroll
==== Sliced scroll
See <<slice-scroll>>.
@ -1057,6 +1071,11 @@ See <<slice-scroll>>.
See <<search-after>>.
[role="exclude",id="request-body-search-search-type"]
==== Search type
See <<search-type>>.
[role="exclude",id="request-body-search-sort"]
==== Sort
@ -1071,4 +1090,8 @@ See <<source-filtering>>.
==== Stored fields
See <<stored-fields>>.
////
[role="exclude",id="request-body-search-track-total-hits"]
==== Track total hits
See <<track-total-hits>>.

View File

@ -154,8 +154,6 @@ high). This default value is `5`.
include::search/search.asciidoc[]
include::search/request-body.asciidoc[]
include::search/async-search.asciidoc[]
include::search/scroll-api.asciidoc[]

View File

@ -0,0 +1,60 @@
[discrete]
[[quickly-check-for-matching-docs]]
=== Quickly check for matching docs
If you only want to know if there are any documents matching a
specific query, you can set the `size` to `0` to indicate that we are not
interested in the search results. You can also set `terminate_after` to `1`
to indicate that the query execution can be terminated whenever the first
matching document was found (per shard).
[source,console]
--------------------------------------------------
GET /_search?q=user.id:elkbee&size=0&terminate_after=1
--------------------------------------------------
// TEST[setup:my_index]
NOTE: `terminate_after` is always applied **after** the
<<post-filter,`post_filter`>> and stops the query as well as the aggregation
executions when enough hits have been collected on the shard. Though the doc
count on aggregations may not reflect the `hits.total` in the response since
aggregations are applied **before** the post filtering.
The response will not contain any hits as the `size` was set to `0`. The
`hits.total` will be either equal to `0`, indicating that there were no
matching documents, or greater than `0` meaning that there were at least
as many documents matching the query when it was early terminated.
Also if the query was terminated early, the `terminated_early` flag will
be set to `true` in the response.
[source,console-result]
--------------------------------------------------
{
"took": 3,
"timed_out": false,
"terminated_early": true,
"_shards": {
"total": 1,
"successful": 1,
"skipped" : 0,
"failed": 0
},
"hits": {
"total" : {
"value": 1,
"relation": "eq"
},
"max_score": null,
"hits": []
}
}
--------------------------------------------------
// TESTRESPONSE[s/"took": 3/"took": $body.took/]
The `took` time in the response contains the milliseconds that this request
took for processing, beginning quickly after the node received the query, up
until all search related work is done and before the above JSON is returned
to the client. This means it includes the time spent waiting in thread pools,
executing a distributed search across the whole cluster and gathering all the
results.

View File

@ -1,197 +0,0 @@
[[search-request-body]]
=== Request Body Search
Specifies search criteria as request body parameters.
[source,console]
--------------------------------------------------
GET /my-index-000001/_search
{
"query" : {
"term" : { "user.id" : "kimchy" }
}
}
--------------------------------------------------
// TEST[setup:my_index]
[[search-request-body-api-request]]
==== {api-request-title}
`GET /<target>/_search
{
"query": {<parameters>}
}`
[[search-request-body-api-desc]]
==== {api-description-title}
The search request can be executed with a search DSL, which includes the
<<query-dsl,Query DSL>>, within its body.
[[search-request-body-api-path-params]]
==== {api-path-parms-title}
`<target>`::
(Optional, string)
Comma-separated list of data streams, indices, and index aliases to search.
Wildcard (`*`) expressions are supported.
+
To search all data streams and indices in a cluster, omit this parameter or use
`_all` or `*`.
[[search-request-body-api-request-body]]
==== {api-request-body-title}
See the search API's <<search-search-api-request-body,request body parameters>>.
==== Fast check for any matching docs
NOTE: `terminate_after` is always applied **after** the `post_filter` and stops
the query as well as the aggregation executions when enough hits have been
collected on the shard. Though the doc count on aggregations may not reflect
the `hits.total` in the response since aggregations are applied **before** the
post filtering.
In case we only want to know if there are any documents matching a
specific query, we can set the `size` to `0` to indicate that we are not
interested in the search results. Also we can set `terminate_after` to `1`
to indicate that the query execution can be terminated whenever the first
matching document was found (per shard).
[source,console]
--------------------------------------------------
GET /_search?q=user.id:elkbee&size=0&terminate_after=1
--------------------------------------------------
// TEST[setup:my_index]
The response will not contain any hits as the `size` was set to `0`. The
`hits.total` will be either equal to `0`, indicating that there were no
matching documents, or greater than `0` meaning that there were at least
as many documents matching the query when it was early terminated.
Also if the query was terminated early, the `terminated_early` flag will
be set to `true` in the response.
[source,console-result]
--------------------------------------------------
{
"took": 3,
"timed_out": false,
"terminated_early": true,
"_shards": {
"total": 1,
"successful": 1,
"skipped" : 0,
"failed": 0
},
"hits": {
"total" : {
"value": 1,
"relation": "eq"
},
"max_score": null,
"hits": []
}
}
--------------------------------------------------
// TESTRESPONSE[s/"took": 3/"took": $body.took/]
The `took` time in the response contains the milliseconds that this request
took for processing, beginning quickly after the node received the query, up
until all search related work is done and before the above JSON is returned
to the client. This means it includes the time spent waiting in thread pools,
executing a distributed search across the whole cluster and gathering all the
results.
[[request-body-search-docvalue-fields]]
==== Doc value fields
See <<docvalue-fields>>.
[[request-body-search-collapse]]
==== Field collapsing
See <<collapse-search-results>>.
[[request-body-search-highlighting]]
==== Highlighting
See <<highlighting>>.
include::request/index-boost.asciidoc[]
[[request-body-search-inner-hits]]
==== Inner hits
See <<inner-hits>>.
[[request-body-search-min-score]]
==== `min_score`
See <<search-api-min-score>>.
[[request-body-search-queries-and-filters]]
==== Named queries
See <<named-queries>>.
[[request-body-search-post-filter]]
==== Post filter
See <<post-filter>>.
include::request/preference.asciidoc[]
[[request-body-search-rescore]]
==== Rescoring
See <<rescore>>.
[[request-body-search-script-fields]]
==== Script fields
See <<script-fields>>.
[[request-body-search-scroll]]
==== Scroll
See <<scroll-search-results>>.
[[_clear_scroll_api]]
===== Clear scroll API
See <<clear-scroll-api>>.
[[sliced-scroll]]
===== Sliced scroll
See <<slice-scroll>>.
[[request-body-search-search-after]]
==== Search After
See <<search-after>>.
include::request/search-type.asciidoc[]
[[request-body-search-sort]]
==== Sort
See <<sort-search-results>>.
[[request-body-search-source-filtering]]
==== Source filtering
See <<source-filtering>>.
[[request-body-search-stored-fields]]
==== Stored fields
See <<stored-fields>>.
include::request/track-total-hits.asciidoc[]

View File

@ -119,7 +119,7 @@ the maximum number of concurrent searches allowed in this phase.
The default is based on the number of data nodes and the default search thread pool size.
WARNING: `collapse` cannot be used in conjunction with <<scroll-search-results, scroll>>,
<<request-body-search-rescore, rescore>> or <<search-after, search after>>.
<<rescore, rescore>> or <<search-after, search after>>.
[discrete]
[[second-level-of-collapsing]]

View File

@ -1,12 +1,11 @@
[[request-body-search-index-boost]]
==== Index Boost
[discrete]
[[index-boost]]
=== Index boost
Allows to configure different boost level per index when searching
across more than one indices. This is very handy when hits coming from
one index matter more than hits coming from another index (think social
graph where each user has an index).
When searching multiple indices, you can use the `indices_boost` parameter to
boost results from one or more specified indices. This is useful when hits
coming from one index matter more than hits coming from another index.
deprecated[5.2.0, This format is deprecated. Please use array format instead.]
[source,console]
--------------------------------------------------
GET /_search

View File

@ -1,7 +1,8 @@
[[request-body-search-preference]]
==== Preference
[discrete]
[[search-preference]]
=== Preference
Controls a `preference` of the shard copies on which to execute the search. By
You can use the `preference` parameter to control the shard copies on which a search runs. By
default, Elasticsearch selects from the available shard copies in an
unspecified order, taking the <<shard-allocation-awareness,allocation awareness>> and
<<search-adaptive-replica,adaptive replica selection>> configuration into

View File

@ -202,7 +202,7 @@ DELETE /_search/scroll/DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMN
[discrete]
[[slice-scroll]]
==== Sliced Scroll
==== Sliced scroll
For scroll queries that return a lot of documents it is possible to split the scroll in multiple slices which
can be consumed independently:

View File

@ -1,5 +1,6 @@
[[request-body-search-search-type]]
==== Search Type
[discrete]
[[search-type]]
=== Search type
There are different execution paths that can be done when executing a
distributed search. The distributed search operation needs to be
@ -34,8 +35,9 @@ to execute on a *per search request* basis. The type can be configured
by setting the *search_type* parameter in the query string. The types
are:
[discrete]
[[query-then-fetch]]
===== Query Then Fetch
==== Query Then Fetch
Parameter value: *query_then_fetch*.
@ -59,8 +61,9 @@ GET my-index-000001/_search?search_type=query_then_fetch
NOTE: This is the default setting, if you do not specify a `search_type`
in your request.
[discrete]
[[dfs-query-then-fetch]]
===== Dfs, Query Then Fetch
==== Dfs, Query Then Fetch
Parameter value: *dfs_query_then_fetch*.

View File

@ -1,5 +1,6 @@
[[request-body-search-track-total-hits]]
==== Track total hits
[discrete]
[[track-total-hits]]
=== Track total hits
Generally the total hit count can't be computed accurately without visiting all
matches, which is costly for queries that match lots of documents. The

View File

@ -228,6 +228,12 @@ GET /*/_search
----
// TEST[setup:my_index]
include::request/index-boost.asciidoc[]
include::request/preference.asciidoc[]
include::request/search-type.asciidoc[]
include::request/track-total-hits.asciidoc[]
include::quickly-check-for-matching-docs.asciidoc[]
include::request/collapse.asciidoc[]
include::filter-search-results.asciidoc[]
include::request/highlighting.asciidoc[]

View File

@ -49,7 +49,7 @@ You can use the `search` input to load Elasticsearch search results as the watch
initial payload.
A <<input-search,search>> input contains a `request` object that specifies the
indices you want to search, the <<request-body-search-search-type,search type>>,
indices you want to search, the <<search-type,search type>>,
and the search request body. The `body` field of a search input is the same as
the body of an Elasticsearch `_search` request, making the full Elasticsearch
Query DSL available for you to use.

View File

@ -9,7 +9,7 @@ into the execution context when the watch is triggered. See
In the search input's `request` object, you specify:
* The indices you want to search
* The <<request-body-search-search-type,search type>>
* The <<search-type,search type>>
* The search request body
The search request body supports the full Elasticsearch Query DSL--it's the
@ -163,7 +163,7 @@ accurately.
|======
| Name |Required | Default | Description
| `request.search_type` | no | `query_then_fetch` | The <<request-body-search-search-type,type>>
| `request.search_type` | no | `query_then_fetch` | The <<search-type,type>>
of search request to perform. Valid values are: `dfs_query_and_fetch`,
`dfs_query_then_fetch`, `query_and_fetch`, and `query_then_fetch`. The
Elasticsearch default is `query_then_fetch`.

View File

@ -55,7 +55,7 @@ The following table lists all available settings for the search
|======
| Name |Required | Default | Description
| `request.search_type` | no | query_then_fetch | The search <<request-body-search-search-type,type>>.
| `request.search_type` | no | query_then_fetch | The search <<search-type,type>>.
| `request.indices` | no | all indices | One or more indices to search on.