@@ -9,8 +9,7 @@ stored in an index. The `percolate` query itself
9
9
contains the document that will be used as query
10
10
to match with the stored queries.
11
11
12
- [discrete]
13
- === Sample usage
12
+ ==== Sample usage
14
13
15
14
TIP: To provide a simple example, this documentation uses one index,
16
15
`my-index-000001`, for both the percolate queries and documents. This setup can
@@ -124,7 +123,6 @@ The above request will yield the following response:
124
123
<2> The `_percolator_document_slot` field indicates which document has matched with this query.
125
124
Useful when percolating multiple document simultaneously.
126
125
127
- [discrete]
128
126
==== Parameters
129
127
130
128
The following parameters are required when percolating a document:
@@ -150,7 +148,6 @@ In that case the `document` parameter can be substituted with the following para
150
148
`preference`:: Optionally, preference to be used to fetch document to percolate.
151
149
`version`:: Optionally, the expected version of the document to be fetched.
152
150
153
- [discrete]
154
151
==== Percolating in a filter context
155
152
156
153
In case you are not interested in the score, better performance can be expected by wrapping
@@ -185,7 +182,6 @@ should be wrapped in a `constant_score` query or a `bool` query's filter clause.
185
182
186
183
Note that the `percolate` query never gets cached by the query cache.
187
184
188
- [discrete]
189
185
==== Percolating multiple documents
190
186
191
187
The `percolate` query can match multiple documents simultaneously with the indexed percolator queries.
@@ -267,14 +263,12 @@ GET /my-index-000001/_search
267
263
<1> The `_percolator_document_slot` indicates that the first, second and last documents specified in the `percolate` query
268
264
are matching with this query.
269
265
270
- [discrete]
271
266
==== Percolating an Existing Document
272
267
273
268
In order to percolate a newly indexed document, the `percolate` query can be used. Based on the response
274
269
from an index request, the `_id` and other meta information can be used to immediately percolate the newly added
275
270
document.
276
271
277
- [discrete]
278
272
===== Example
279
273
280
274
Based on the previous example.
@@ -332,14 +326,12 @@ case the search request would fail with a version conflict error.
332
326
333
327
The search response returned is identical as in the previous example.
334
328
335
- [discrete]
336
329
==== Percolate query and highlighting
337
330
338
331
The `percolate` query is handled in a special way when it comes to highlighting. The queries hits are used
339
332
to highlight the document that is provided in the `percolate` query. Whereas with regular highlighting the query in
340
333
the search request is used to highlight the hits.
341
334
342
- [discrete]
343
335
===== Example
344
336
345
337
This example is based on the mapping of the first example.
@@ -557,7 +549,6 @@ The slightly different response:
557
549
<1> The highlight fields have been prefixed with the document slot they belong to,
558
550
in order to know which highlight field belongs to what document.
559
551
560
- [discrete]
561
552
==== Specifying multiple percolate queries
562
553
563
554
It is possible to specify multiple `percolate` queries in a single search request:
@@ -643,7 +634,6 @@ The above search request returns a response similar to this:
643
634
<1> The `_percolator_document_slot_query1` percolator slot field indicates that these matched slots are from the `percolate`
644
635
query with `_name` parameter set to `query1`.
645
636
646
- [discrete]
647
637
[[how-it-works]]
648
638
==== How it Works Under the Hood
649
639
@@ -691,6 +681,7 @@ a different index configuration, like the number of primary shards.
691
681
692
682
[[percolate-query-notes]]
693
683
==== Notes
684
+
694
685
===== Allow expensive queries
695
686
Percolate queries will not be executed if <<query-dsl-allow-expensive-queries, `search.allow_expensive_queries`>>
696
687
is set to false.
0 commit comments