Skip to content
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

Fix synonyms documentation #100916

Conversation

carlosdelest
Copy link
Member

Fix documentation related synonym / synonym graph token filters

@github-actions
Copy link
Contributor

Documentation preview:

@elasticsearchmachine elasticsearchmachine added Team:Docs Meta label for docs team v8.12.0 labels Oct 16, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-docs (Team:Docs)

In the above example, text will be lowercased by the `lowercase` filter before being processed by the `synonyms_filter`.
This means that all the synonyms defined there needs to be in lowercase, or they won't be found by the synonyms filter.
{es} will also use the token filters preceding the synonym filter in a tokenizer chain to parse the entries in a synonym file.
In the above example, the synonyms graph token filter is placed after a stemmer. The stemmer will also be applied to the synonym entries.
Copy link
Contributor

@mayya-sharipova mayya-sharipova Oct 16, 2023

Choose a reason for hiding this comment

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

May be we can say it shorter to avoid repetitions:

Order is important for your token filters.
Text will be processed first through filters preceding the synonym filter before being processed by the synonym filter. 
For example, for the above analyzer, {es} will first apply `stemmer` filter to the text, and after that apply `synonym_graph` token filter. 

Copy link
Member

Choose a reason for hiding this comment

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

@mayya-sharipova its important to clarify if we also apply the token filters on the synonyms when they are loaded from the file. This way any stemmer is also applied to the previously stored synonyms.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've tried to make the example as close as possible to the previous one to avoid further confusion. I've added synonym set as well to synonym file to ensure users understand that it applies to any synonym configuration.

@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.10

carlosdelest added a commit to carlosdelest/elasticsearch that referenced this pull request Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants