Skip to content

Commit

Permalink
[DOCS] Move post filter/rescore content to new page (#60903) (#60962)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrodewig authored Aug 11, 2020
1 parent 0813c44 commit 7a8f860
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 16 deletions.
12 changes: 11 additions & 1 deletion docs/reference/redirects.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions docs/reference/search/filter-search-results.asciidoc
Original file line number Diff line number Diff line change
@@ -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[]
12 changes: 9 additions & 3 deletions docs/reference/search/request-body.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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>>.

Expand Down
13 changes: 7 additions & 6 deletions docs/reference/search/request/post-filter.asciidoc
Original file line number Diff line number Diff line change
@@ -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]
--------------------------------------------------
Expand Down
17 changes: 11 additions & 6 deletions docs/reference/search/request/rescore.asciidoc
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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.

Expand Down Expand Up @@ -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:

Expand Down
1 change: 1 addition & 0 deletions docs/reference/search/search-your-data.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
Expand Down

0 comments on commit 7a8f860

Please sign in to comment.