[DOCS] Move post filter/rescore content to new page (#60903) (#60961)

This commit is contained in:
James Rodewig 2020-08-11 09:06:59 -04:00 committed by GitHub
parent 18a65c5b9a
commit 4aae278d1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 59 additions and 16 deletions

View File

@ -91,7 +91,7 @@ See <<named-queries>>.
[role="exclude",id="search-request-post-filter"]
=== Post filter parameter for request body search API
See <<request-body-search-post-filter>>.
See <<post-filter>>.
[role="exclude",id="search-request-preference"]
=== Preference parameter for request body search API
@ -1022,6 +1022,16 @@ See <<search-api-min-score>>.
See <<named-queries>.
[role="exclude",id="request-body-search-post-filter"]
=== Post filter
See <<post-filter>>.
[role="exclude",id="request-body-search-rescore"]
=== Rescoring
See <<rescore>>.
[role="exclude",id="request-body-search-script-fields"]
==== Script fields

View File

@ -0,0 +1,20 @@
[[filter-search-results]]
== Filter search results
You can use two methods to filter search results:
* Use a boolean query with a `filter` clause. Search requests apply
<<query-dsl-bool-query,boolean filters>> to both search hits and
<<search-aggregations,aggregations>>.
* Use the search API's `post_filter` parameter. Search requests apply
<<post-filter,post filters>> only to search hits, not aggregations. You can use
a post filter to calculate aggregations based on a broader result set, and then
further narrow the results.
+
You can also <<rescore,rescore>> hits after the post filter to
improve relevance and reorder results.
include::request/post-filter.asciidoc[]
include::request/rescore.asciidoc[]

View File

@ -140,14 +140,20 @@ See <<search-api-min-score>>.
See <<named-queries>>.
include::request/post-filter.asciidoc[]
[[request-body-search-post-filter]]
==== Post filter
See <<post-filter>>.
include::request/preference.asciidoc[]
include::request/rescore.asciidoc[]
[[request-body-search-rescore]]
==== Rescoring
See <<rescore>>.
[[request-body-search-script-fields]]
==== Script Fields
==== Script fields
See <<script-fields>>.

View File

@ -1,11 +1,12 @@
[[request-body-search-post-filter]]
==== Post filter
[discrete]
[[post-filter]]
=== Post filter
The `post_filter` is applied to the search `hits` at the very end of a search
request, after aggregations have already been calculated. Its purpose is
best explained by example:
When you use the `post_filter` parameter to filter search results, the search
hits are filtered after the aggregations are calculated. A post filter has no
impact on the aggregation results.
Imagine that you are selling shirts that have the following properties:
For example, you are selling shirts that have the following properties:
[source,console]
--------------------------------------------------

View File

@ -1,10 +1,11 @@
[[request-body-search-rescore]]
==== Rescoring
[discrete]
[[rescore]]
=== Rescore filtered search results
Rescoring can help to improve precision by reordering just the top (eg
100 - 500) documents returned by the
<<request-body-search-query,`query`>> and
<<request-body-search-post-filter,`post_filter`>> phases, using a
<<post-filter,`post_filter`>> phases, using a
secondary (usually more costly) algorithm, instead of applying the
costly algorithm to all documents in the index.
@ -23,11 +24,13 @@ NOTE: when exposing pagination to your users, you should not change
`from` values) since that can alter the top hits causing results to
confusingly shift as the user steps through pages.
===== Query rescorer
[discrete]
[[query-rescorer]]
==== Query rescorer
The query rescorer executes a second query only on the Top-K results
returned by the <<request-body-search-query,`query`>> and
<<request-body-search-post-filter,`post_filter`>> phases. The
<<post-filter,`post_filter`>> phases. The
number of docs which will be examined on each shard can be controlled by
the `window_size` parameter, which defaults to 10.
@ -82,7 +85,9 @@ for <<query-dsl-function-score-query,`function query`>> rescores.
|`min` |Take the min of the original score and the rescore query score.
|=======================================================================
===== Multiple Rescores
[discrete]
[[multiple-rescores]]
==== Multiple rescores
It is also possible to execute multiple rescores in sequence:

View File

@ -229,6 +229,7 @@ GET /*/_search
// TEST[setup:my_index]
include::request/collapse.asciidoc[]
include::filter-search-results.asciidoc[]
include::request/highlighting.asciidoc[]
include::{es-repo-dir}/async-search.asciidoc[]
include::{es-repo-dir}/search/near-real-time.asciidoc[]