@@ -9,8 +9,13 @@ stored in an index. The `percolate` query itself
99contains the document that will be used as query
1010to match with the stored queries.
1111
12- [discrete]
13- === Sample Usage
12+ ==== Sample usage
13+
14+ TIP: To provide a simple example, this documentation uses one index,
15+ `my-index-000001`, for both the percolate queries and documents. This setup can
16+ work well when there are just a few percolate queries registered. For heavier
17+ usage, we recommend you store queries and documents in separate indices. For
18+ more details, refer to <<how-it-works>>.
1419
1520Create an index with two fields:
1621
@@ -118,11 +123,6 @@ The above request will yield the following response:
118123<2> The `_percolator_document_slot` field indicates which document has matched with this query.
119124 Useful when percolating multiple document simultaneously.
120125
121- TIP: To provide a simple example, this documentation uses one index `my-index-000001` for both the percolate queries and documents.
122- This set-up can work well when there are just a few percolate queries registered. However, with heavier usage it is recommended
123- to store queries and documents in separate indices. Please see <<how-it-works, How it Works Under the Hood>> for more details.
124-
125- [discrete]
126126==== Parameters
127127
128128The following parameters are required when percolating a document:
@@ -148,7 +148,6 @@ In that case the `document` parameter can be substituted with the following para
148148`preference`:: Optionally, preference to be used to fetch document to percolate.
149149`version`:: Optionally, the expected version of the document to be fetched.
150150
151- [discrete]
152151==== Percolating in a filter context
153152
154153In case you are not interested in the score, better performance can be expected by wrapping
@@ -183,7 +182,6 @@ should be wrapped in a `constant_score` query or a `bool` query's filter clause.
183182
184183Note that the `percolate` query never gets cached by the query cache.
185184
186- [discrete]
187185==== Percolating multiple documents
188186
189187The `percolate` query can match multiple documents simultaneously with the indexed percolator queries.
@@ -265,14 +263,12 @@ GET /my-index-000001/_search
265263<1> The `_percolator_document_slot` indicates that the first, second and last documents specified in the `percolate` query
266264 are matching with this query.
267265
268- [discrete]
269266==== Percolating an Existing Document
270267
271268In order to percolate a newly indexed document, the `percolate` query can be used. Based on the response
272269from an index request, the `_id` and other meta information can be used to immediately percolate the newly added
273270document.
274271
275- [discrete]
276272===== Example
277273
278274Based on the previous example.
@@ -330,14 +326,12 @@ case the search request would fail with a version conflict error.
330326
331327The search response returned is identical as in the previous example.
332328
333- [discrete]
334329==== Percolate query and highlighting
335330
336331The `percolate` query is handled in a special way when it comes to highlighting. The queries hits are used
337332to highlight the document that is provided in the `percolate` query. Whereas with regular highlighting the query in
338333the search request is used to highlight the hits.
339334
340- [discrete]
341335===== Example
342336
343337This example is based on the mapping of the first example.
@@ -555,7 +549,6 @@ The slightly different response:
555549<1> The highlight fields have been prefixed with the document slot they belong to,
556550 in order to know which highlight field belongs to what document.
557551
558- [discrete]
559552==== Specifying multiple percolate queries
560553
561554It is possible to specify multiple `percolate` queries in a single search request:
@@ -641,7 +634,6 @@ The above search request returns a response similar to this:
641634<1> The `_percolator_document_slot_query1` percolator slot field indicates that these matched slots are from the `percolate`
642635 query with `_name` parameter set to `query1`.
643636
644- [discrete]
645637[[how-it-works]]
646638==== How it Works Under the Hood
647639
@@ -689,6 +681,7 @@ a different index configuration, like the number of primary shards.
689681
690682[[percolate-query-notes]]
691683==== Notes
684+
692685===== Allow expensive queries
693686Percolate queries will not be executed if <<query-dsl-allow-expensive-queries, `search.allow_expensive_queries`>>
694687is set to false.
0 commit comments