Skip to content

Commit 00881d9

Browse files
authored
[DOCS] Move post filter/rescore content to new page (#60903)
1 parent 2ed1359 commit 00881d9

6 files changed

+59
-16
lines changed

docs/reference/redirects.asciidoc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ See <<named-queries>>.
9797

9898
[role="exclude",id="search-request-post-filter"]
9999
=== Post filter parameter for request body search API
100-
See <<request-body-search-post-filter>>.
100+
See <<post-filter>>.
101101

102102
[role="exclude",id="search-request-preference"]
103103
=== Preference parameter for request body search API
@@ -1029,6 +1029,16 @@ See <<search-api-min-score>>.
10291029
10301030
See <<named-queries>.
10311031
1032+
[role="exclude",id="request-body-search-post-filter"]
1033+
=== Post filter
1034+
1035+
See <<post-filter>>.
1036+
1037+
[role="exclude",id="request-body-search-rescore"]
1038+
=== Rescoring
1039+
1040+
See <<rescore>>.
1041+
10321042
[role="exclude",id="request-body-search-script-fields"]
10331043
==== Script fields
10341044
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[[filter-search-results]]
2+
== Filter search results
3+
4+
You can use two methods to filter search results:
5+
6+
* Use a boolean query with a `filter` clause. Search requests apply
7+
<<query-dsl-bool-query,boolean filters>> to both search hits and
8+
<<search-aggregations,aggregations>>.
9+
10+
* Use the search API's `post_filter` parameter. Search requests apply
11+
<<post-filter,post filters>> only to search hits, not aggregations. You can use
12+
a post filter to calculate aggregations based on a broader result set, and then
13+
further narrow the results.
14+
+
15+
You can also <<rescore,rescore>> hits after the post filter to
16+
improve relevance and reorder results.
17+
18+
include::request/post-filter.asciidoc[]
19+
20+
include::request/rescore.asciidoc[]

docs/reference/search/request-body.asciidoc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,20 @@ See <<search-api-min-score>>.
140140

141141
See <<named-queries>>.
142142

143-
include::request/post-filter.asciidoc[]
143+
[[request-body-search-post-filter]]
144+
==== Post filter
145+
146+
See <<post-filter>>.
144147

145148
include::request/preference.asciidoc[]
146149

147-
include::request/rescore.asciidoc[]
150+
[[request-body-search-rescore]]
151+
==== Rescoring
152+
153+
See <<rescore>>.
148154

149155
[[request-body-search-script-fields]]
150-
==== Script Fields
156+
==== Script fields
151157

152158
See <<script-fields>>.
153159

docs/reference/search/request/post-filter.asciidoc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
[[request-body-search-post-filter]]
2-
==== Post filter
1+
[discrete]
2+
[[post-filter]]
3+
=== Post filter
34

4-
The `post_filter` is applied to the search `hits` at the very end of a search
5-
request, after aggregations have already been calculated. Its purpose is
6-
best explained by example:
5+
When you use the `post_filter` parameter to filter search results, the search
6+
hits are filtered after the aggregations are calculated. A post filter has no
7+
impact on the aggregation results.
78

8-
Imagine that you are selling shirts that have the following properties:
9+
For example, you are selling shirts that have the following properties:
910

1011
[source,console]
1112
--------------------------------------------------

docs/reference/search/request/rescore.asciidoc

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
[[request-body-search-rescore]]
2-
==== Rescoring
1+
[discrete]
2+
[[rescore]]
3+
=== Rescore filtered search results
34

45
Rescoring can help to improve precision by reordering just the top (eg
56
100 - 500) documents returned by the
67
<<request-body-search-query,`query`>> and
7-
<<request-body-search-post-filter,`post_filter`>> phases, using a
8+
<<post-filter,`post_filter`>> phases, using a
89
secondary (usually more costly) algorithm, instead of applying the
910
costly algorithm to all documents in the index.
1011

@@ -23,11 +24,13 @@ NOTE: when exposing pagination to your users, you should not change
2324
`from` values) since that can alter the top hits causing results to
2425
confusingly shift as the user steps through pages.
2526

26-
===== Query rescorer
27+
[discrete]
28+
[[query-rescorer]]
29+
==== Query rescorer
2730

2831
The query rescorer executes a second query only on the Top-K results
2932
returned by the <<request-body-search-query,`query`>> and
30-
<<request-body-search-post-filter,`post_filter`>> phases. The
33+
<<post-filter,`post_filter`>> phases. The
3134
number of docs which will be examined on each shard can be controlled by
3235
the `window_size` parameter, which defaults to 10.
3336

@@ -82,7 +85,9 @@ for <<query-dsl-function-score-query,`function query`>> rescores.
8285
|`min` |Take the min of the original score and the rescore query score.
8386
|=======================================================================
8487

85-
===== Multiple Rescores
88+
[discrete]
89+
[[multiple-rescores]]
90+
==== Multiple rescores
8691

8792
It is also possible to execute multiple rescores in sequence:
8893

docs/reference/search/search-your-data.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ GET /*/_search
228228
// TEST[setup:my_index]
229229

230230
include::request/collapse.asciidoc[]
231+
include::filter-search-results.asciidoc[]
231232
include::request/highlighting.asciidoc[]
232233
include::{es-repo-dir}/async-search.asciidoc[]
233234
include::{es-repo-dir}/search/near-real-time.asciidoc[]

0 commit comments

Comments
 (0)