wip/experimental(elasticsearch): Use secondary index for Item and ImageObject#1569
Draft
wip/experimental(elasticsearch): Use secondary index for Item and ImageObject#1569
Conversation
kwahlin
approved these changes
Mar 6, 2025
Contributor
kwahlin
left a comment
There was a problem hiding this comment.
Nice! If it seems to work let's try it out in a test environment.
olovy
approved these changes
Mar 13, 2025
Contributor
olovy
left a comment
There was a problem hiding this comment.
Nice!
Agree that this is a good starting point for measuring potential performance improvements etc.
Also nice to see that splitting the index requires relatively minor changes.
If we are happy with this there is a clear path to generalize it to separate indices per selected base type. And of course select indices to search based on the query.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
So as to not burden the main ES index with a massive amount of Item and ImageObject records (that we usually don't care much about when searching) we've talked about using separate indices. Here's a very simple way of doing that. Not saying it's necessarily a good way, but just to open up the discussion and get more ideas. It Seems To Work (tm).
Essentially this just splits ES into a "main" index and a "secondary" index, for lack of a better name, with the latter having only Item and ImageObject records. Both are used by default when searching, so no change from the outside.
_searchMainOnly=truecan be added to not search the secondary index. Index to use when adding/updating records is determined based on type.To try it locally see https://github.com/libris/devops/tree/feature/use-secondary-es-index for some quick and dirty devops support.