Description
Tim Schimandle opened DATAES-192 and commented
Currently spring data ES documents are defined by an index name that can be set via annotations on the document. This works well for simple cases in which a single index will suffice.
When a user wishes to do something more complex, like swap indexes dynamically, elasticsearch's reccomended way is to define an alias, and associate all operations to the alias. In the background the user can now build a second index with updated information and then direct elasticsearch to use that index by changing the reference in the alias.
Spring data ES does not currently support the definition of an alias on a document that will be used in all JPA default queries or by the elasticsearch template. This makes working with aliases difficult as it requires the user to abandon all of the default queries provided by the JPA implementation.
A solution to this problem would be to expose a property in the Document annotation that would define an aliasName. If present, an alias would be created and the underlying index would be associated with that alias. In all of the searching functions when an indexName is needed, if there is an aliasName the aliasName is used to perform the search. For functions that require access to the index directly the elasticsearch client can get a list of indexes associated with the alias and operate on them. The solution would have to handle the possibility of the alias already being created.
@Document
(aliasName = "test-alias", indexName = "test", type = "test")
Affects: 1.2.2 (Fowler SR2)
Issue Links:
- DATAES-864 Rework alias management
("is superseded by")
11 votes, 9 watchers