-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Auto-reload synonym analyzers on synonyms updates #96886
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
Auto-reload synonym analyzers on synonyms updates #96886
Conversation
Synonym Management API project On changes of synonyms in a synonym set, auto-reload analyzers. Note that currently all updateable analyzers will be reloaded, even those that are not relevant for a synonyms set being updated.
Pinging @elastic/es-search (Team:Search) |
- match: { reload_analyzers_details.reload_details.0.index: "my_index" } | ||
- match: { reload_analyzers_details.reload_details.0.reloaded_analyzers.0 : "my_analyzer" } | ||
|
||
# Confirm that the index analyzers are reloaded |
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.
I like this test ❤️
rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/synonyms/10_synonyms_put.yml
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/action/synonyms/DeleteSynonymsAction.java
Outdated
Show resolved
Hide resolved
: UpdateSynonymsResultStatus.UPDATED; | ||
|
||
// auto-reload all reloadable analyzers (currently only those that use updateable synonym or keyword_marker filters) | ||
// TODO: reload only those analyzers that use this synonymsSet |
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.
What are your thoughts for reloading just the analyzers for the specific syonyms set? Do it in a follow up PR? Or do we need some additional infra for retrieving the analyzers that use it?
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.
Right, we can do this in a follow-up. It is not trivial how to do this efficiently.
This PR adds a new optional parameter "resource" for ReloadAnalyzersRequest. If used, only analyzers that use this specific "resource" will be reload. This parameter is not documented, for internal use only. PR elastic#96886 introduced auto-reload of analyzers on synonyms index change. The problem was that reloading was applied broady for all indices that contained reloadable analyzers. This PR improves this, so when a particular synonyms set changes, only analyzers that use this synonyms set will auto-reloaded. Note that shard requests will still be sent to all indices shards, as only on a shard we can decide if analyzers need to be reloaded.
This PR adds a new optional parameter "resource" for ReloadAnalyzersRequest. If used, only analyzers that use this specific "resource" will be reload. This parameter is not documented, for internal use only. PR #96886 introduced auto-reload of analyzers on synonyms index change. The problem was that reloading was applied broadly for all indices that contained reloadable analyzers. This PR improves this, so when a particular synonyms set changes, only analyzers that use this synonyms set will auto-reloaded. Note that shard requests will still be sent to all indices shards, as only on a shard we can decide if analyzers need to be reloaded.
Synonym Management API project
On changes of synonyms in a synonym set, auto-reload analyzers.
Note that currently all updateable analyzers will be reloaded, even
those that are not relevant for a synonyms set being updated.
Responses from PUT and DELETE synonyms set are enhanced to
contain reload analyzers details.
For a PUT synonyms set request, an example of response:
PUT _synonyms/set1
or an update:
For a DELETE synonyms set request, if the deleted synonyms set is in use, a response
will contain reload failures, like below:
And it is left for a user to fix affected indices.