-
Notifications
You must be signed in to change notification settings - Fork 126
Support knn filter on nested metadata #2315
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
Support knn filter on nested metadata #2315
Conversation
This is to update our documentation that we now can support knn filter on nested metadata. Related to elastic/elasticsearch#113949
🔍 Preview links for changed docs |
Hi @mayya-sharipova, just a note that if you're adding sections or information that pertains to specific versions, i.e. 9.2 in this case, you'll need to use applies_to tags to signal that on the page. Because the 9.x docs all live on one page nowadays instead of having separate minor version branches for each docs page. For example, here's a section-level applies to used just after a heading: ## My new heading for a new feature
```{applies_to}
stack: ga 9.2
``` This means we shouldn't delete information from a page, or change pre-existing information without the correct tags. We can use applies_to at page level, section level, and inline where necessary: https://elastic.github.io/docs-builder/syntax/applies/#when-and-where-to-use-applies_to Feel free to reach out on #docs if need an assist :) |
@leemthompo Thanks for the update. Would appreciate your help structuring the following: I have this section that is not true anymore from 9.2. How to indicate that is only applicable before 9.2 release? Is there a way to say applies before 9.2?
How it should be modified to this from 9.2 release.
|
@mayya-sharipova Can achieve this by basically saying you have two ways to filter and noting that the nested metadata option is only available in 9.2+? Something like this: Want to filter by metadata? You can do this by adding `filter` to your `knn` clause.
To ensure correct results, each individual filter must be either over:
- Top-level metadata
- `nested` metadata {applies_to}`stack: ga 9.2`
:::{note}
A single `knn` search supports multiple filters, where some filters can be over the top-level metadata and some over nested.
::: That way it's clear that the second option is only available in 9.2+. |
Thanks @leemthompo, I've added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working with the applies_to
markers @mayya-sharipova! 🙏
LGTM, with a few minor suggestions. Not sure if you want a peer dev review on the technical details before merging.
Co-authored-by: Liam Thompson <[email protected]>
Co-authored-by: Liam Thompson <[email protected]>
Co-authored-by: Liam Thompson <[email protected]>
Co-authored-by: Liam Thompson <[email protected]>
@leemthompo Thanks for review, I've committed your changes.
The main Elasticsearch PR that introduces similar changes to knn query documentation has been already approved, so I think it is not necessary for another approval on the technical details. |
@mayya-sharipova gotcha, but bad news is we need applies_to's also in the I dropped a note in Slack recently to repeat the signal :) |
This is to update our documentation that we now can support knn filter on nested metadata.
Related to elastic/elasticsearch#113949