Skip to content

adding percolate query dsl docs #9798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

AntonEliatra
Copy link
Contributor

Description

adding percolate query dsl docs

Version

all

Checklist

  • By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and subject to the Developers Certificate of Origin.
    For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Anton Rubin <anton.rubin@eliatra.com>
Copy link

Thank you for submitting your PR. The PR states are In progress (or Draft) -> Tech review -> Doc review -> Editorial review -> Merged.

Before you submit your PR for doc review, make sure the content is technically accurate. If you need help finding a tech reviewer, tag a maintainer.

When you're ready for doc review, tag the assignee of this PR. The doc reviewer may push edits to the PR directly or leave comments and editorial suggestions for you to address (let us know in a comment if you have a preference). The doc reviewer will arrange for an editorial review.

Signed-off-by: Anton Rubin <anton.rubin@eliatra.com>
…atra/documentation-website into adding-perculate-query-dsl-docs
@kolchfa-aws
Copy link
Collaborator

@kaushalmahi12 Could you please review this PR? Please carefully review the "Batch compared to named percolation" section and the table provided. The entry marked "Not possible" did not work - is there a way to get it working? Thanks!

Copy link
Contributor

@kaushalmahi12 kaushalmahi12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some minor comments

Comment on lines +278 to +279

You can percolate different documents inside a named query:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also mention the comparative performance of this ways vs multiple documents in single percolate query

Copy link
Contributor Author

@AntonEliatra AntonEliatra Jul 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kaushalmahi12 Thank you for the review. Regarding this comment, is the difference not already sufficiently covers in "Batch compared to named percolation", later in the page?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see!, thanks

Signed-off-by: Anton Rubin <anton.rubin@eliatra.com>
Comment on lines +278 to +279

You can percolate different documents inside a named query:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see!, thanks

Copy link
Collaborator

@kolchfa-aws kolchfa-aws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @AntonEliatra! Please see my comments and let me know if you have any questions.

@@ -13,7 +13,7 @@ redirect_from:
**Introduced 1.0**
{: .label .label-purple }

A percolator field type specifies to treat this field as a query. Any JSON object field can be marked as a percolator field. Normally, documents are indexed and searches are run against them. When you use a percolator field, you store a search, and later the percolate query matches documents to that search.
A percolator field type specifies to treat this field as a query. Any JSON object field can be marked as a percolator field. Normally, documents are indexed and searches are run against them. When you use a percolator field, you store a search, and later the percolate query matches documents to that search. For detailed example see [Percolate]({{site.url}}{{site.baseurl}}/query-dsl/specialized/percolate/)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
A percolator field type specifies to treat this field as a query. Any JSON object field can be marked as a percolator field. Normally, documents are indexed and searches are run against them. When you use a percolator field, you store a search, and later the percolate query matches documents to that search. For detailed example see [Percolate]({{site.url}}{{site.baseurl}}/query-dsl/specialized/percolate/)
A percolator field type specifies to treat this field as a query. Any JSON object field can be marked as a percolator field. Normally, documents are indexed and searches are run against them. When you use a percolator field, you store a search, and later the percolate query matches documents to that search. For a detailed example see [Percolate]({{site.url}}{{site.baseurl}}/query-dsl/specialized/percolate/)


# Percolate

Use the `percolate` query to find stored queries that match a given document. This is the opposite of a regular search. Instead of finding documents that match a query, you find queries that match a document. Percolate queries are often used for alerting, notifications, and reverse search use cases.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Use the `percolate` query to find stored queries that match a given document. This is the opposite of a regular search. Instead of finding documents that match a query, you find queries that match a document. Percolate queries are often used for alerting, notifications, and reverse search use cases.
Use the `percolate` query to find stored queries that match a given document. This operation is the opposite of a regular search: instead of finding documents that match a query, you find queries that match a document. Percolate queries are often used for alerting, notifications, and reverse search use cases.


Use the `percolate` query to find stored queries that match a given document. This is the opposite of a regular search. Instead of finding documents that match a query, you find queries that match a document. Percolate queries are often used for alerting, notifications, and reverse search use cases.

- You can percolate a document provided inline or fetch an existing document from an index.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide an intro sentence for this list.

- You can percolate a document provided inline or fetch an existing document from an index.
- The document and the stored queries must use the same field names and types.
- You can combine percolation with filtering and scoring to build complex matching systems.
- Percolate queries are considered expensive and will only run if the cluster setting `search.allow_expensive_queries` is set to `true` (default). If this setting is `false`, percolate queries will be rejected.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link to expensive queries section on the main query DSL page


Percolate queries are useful in a variety of real-time matching scenarios. Some common use cases include:

- **E-commerce notifications**: Customers can register interest in products, for example: “Notify me when new Apple laptops are in stock”. When new product documents are indexed, the system finds all users with matching saved queries and sends alerts.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **E-commerce notifications**: Customers can register interest in products, for example: “Notify me when new Apple laptops are in stock”. When new product documents are indexed, the system finds all users with matching saved queries and sends alerts.
- **E-commerce notifications**: Users can register interest in products, for example: “Notify me when new Apple laptops are in stock”. When new product documents are indexed, the system finds all users with matching saved queries and sends alerts.

| `field` | Required | Field containing the stored percolator queries. |
| `document` | Optional | Single inline document to match against saved queries. |
| `documents` | Optional | Array of multiple inline documents to match. |
| `index` | Optional | Index containing the document you want to match. |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `index` | Optional | Index containing the document you want to match. |
| `index` | Optional | An index containing the document you want to match. |

| `document` | Optional | Single inline document to match against saved queries. |
| `documents` | Optional | Array of multiple inline documents to match. |
| `index` | Optional | Index containing the document you want to match. |
| `id` | Optional | ID of the document to fetch from the index. |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `id` | Optional | ID of the document to fetch from the index. |
| `id` | Optional | The ID of the document to fetch from the index. |

| `documents` | Optional | Array of multiple inline documents to match. |
| `index` | Optional | Index containing the document you want to match. |
| `id` | Optional | ID of the document to fetch from the index. |
| `routing` | Optional | Routing value to use when fetching the document. |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `routing` | Optional | Routing value to use when fetching the document. |
| `routing` | Optional | The routing value to use when fetching the document. |

| `index` | Optional | Index containing the document you want to match. |
| `id` | Optional | ID of the document to fetch from the index. |
| `routing` | Optional | Routing value to use when fetching the document. |
| `preference` | Optional | Preference for the shard routing when fetching the document. |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `preference` | Optional | Preference for the shard routing when fetching the document. |
| `preference` | Optional | The preference for the shard routing when fetching the document. |

| `id` | Optional | ID of the document to fetch from the index. |
| `routing` | Optional | Routing value to use when fetching the document. |
| `preference` | Optional | Preference for the shard routing when fetching the document. |
| `name` | Optional | Name assigned to a percolate clause, helpful when using multiple percolates in a `bool` query. |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `name` | Optional | Name assigned to a percolate clause, helpful when using multiple percolates in a `bool` query. |
| `name` | Optional | The name assigned to a `percolate` clause. Helpful when using multiple `percolate` clauses in a `bool` query. |

@kolchfa-aws kolchfa-aws added 4 - Doc review PR: Doc review in progress and removed 3 - Tech review PR: Tech review in progress labels Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants