-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Define alias for document [DATAES-192] #767
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
Comments
hung bang commented Mohsin Husen Is there any pieces of information related to this issue?
|
wujun8 commented This feature is certainly needed in the process of reindex |
Erik Saly commented Currently looking at reindexing, this would be really nice to have! Right now, it's a bit of a pain |
Matt commented Looking to being able to read from an index based on an alias, and this would be super helpful. |
Matt commented Was able to get the document annotation reading from an alias by specifying indexName=aliasName, type=_doc, and createIndex=false. |
sothawo commented Done with DATAES-864 |
What if I need thousands of aliases? Better yet, I have no idea how many aliases I need when creating the mapping.
Would you recommend creating a new enhancement issue? Found the solution here: #562 Will try it out! |
You do not create the aliases with the mapping. The mapping defines the fields within an index. |
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:
("is superseded by")
11 votes, 9 watchers
The text was updated successfully, but these errors were encountered: