[JAY-676] Introducing querying / pushing to multiple indexes at the same time#35
Merged
Conversation
Zauze
reviewed
Aug 20, 2025
Zauze
approved these changes
Aug 20, 2025
82e37b9 to
549b4af
Compare
Zauze
reviewed
Aug 21, 2025
Zauze
approved these changes
Aug 21, 2025
Zauze
approved these changes
Aug 21, 2025
Zauze
approved these changes
Aug 21, 2025
Creates the Indexable mixin and moves much of the code from the Elasticsearch::Index class there. These methods can actually be used with a single index or with multiple indexes. In an upcoming commit these methods will be used by another class which will allow multiple indexes to be searched. Data could also be pushed to multiple indexes at the same time.
Moves the test code for the methods that were moved to the Indexable mixin to a shared examples file. This test code will be used in an upcoming commit in order to test other classes that include the mixin. Note: Some changes were made to the test code in order to allow it to work in a shared_examples / shared_context block. These changes are mainly inconsequential, for example, moving the parameters of a method call to a separate let.
This is possible because some of the methods of the underlying Elasticsearch client can accept and act over multiple indexes. For those that can only act over a single index, like #index and #bulk extra logic is added to handle this on the Jay API side. In order to keep backwards compatibility a small amount of logic is added to the Index class so that the constructor parameters and the return values of the methods can stay the same.
The class represents a set of Elasticsearch indexes. Through the class it is possible to query multiple indexes or push data to them at the same time. The class doesn't really add any logic. All the functional logic is just taken from the Indexable mixin. Because of the way the #push method works. When the batch_size is not a multiple of the number of indexes it is possible for the pushed batch to be slightly bigger than batch_size. Hence a Warning is logged when this condition is detected by the Indexes class's constructor.
Changes the documentation for some methods to make it clear that they can actually take any class which includes the Indexable mixin as opposed to requiring explicitly an Elasticsearch::Index object.
Adds documentation about the Indexable mixin and the classes that include it. Just like in previous commits the common elements are being moved to a shared place, in this case, the documentation for Index now resides in the documentation page for Indexable.
549b4af to
6e68bce
Compare
Zauze
approved these changes
Aug 22, 2025
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.
The changes in this pull request will add an API that allows the user to query or push data to multiple indexes at the same time. The changes in terms of actual logic are really small since many of the methods of the underlying Elasticsearch client can take multiple indexes.
In order to accomplish this the following changes are being introduced:
Indexablemixin.Indexclass. Mainly to allow it to take the same parameters and return the same types for all the methods it already had.Indexesclass is being added. This class has almost no logic since the core logic in theIndexablemixin is taking care of everything. The class is being introduced only for mnemonic purposes. I.e. to make the difference between working with one and multiple indexes obvious.