-
Notifications
You must be signed in to change notification settings - Fork 6
Alias and force name #29
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
base: master
Are you sure you want to change the base?
Conversation
@@ -261,6 +265,18 @@ def alias_exists?(alias_name) | |||
) | |||
end | |||
|
|||
def parent_index_names | |||
client.indices.get_alias(name: config_name).map { |k, v| k } |
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.
client.indices.get_alias(name: config_name).map { |k, v| k } | |
client.indices.get_alias(name: config_name).keys |
def parent_index_names | ||
client.indices.get_alias(name: config_name).map { |k, v| k } | ||
rescue Elasticsearch::Transport::Transport::Errors::NotFound | ||
nil |
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'd rather return an empty array here and keep the return type consistent.
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.
True, much better
@@ -29,6 +29,10 @@ def initialize(index_name, options = {}) | |||
@subs = @subs.flatten if @subs.is_a?(Array) | |||
end | |||
|
|||
if options['force_name'].present? | |||
@force_name = options['force_name'] |
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.
Is there a reason to call this force_name
versus alias_name
?
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.
Because an index name could also be used. It is an overwriting from the name on the config file.
To be able to migrate indexes with no downtime we need to be able to use aliases and to create indexes with custom names on ES. This PR adds the possibility of using custom names (outside of config) and adds methods to be able to get to the index reference (for creation and deletion) if using an alias.