Skip to content

Commit

Permalink
fix elasticsearch custom alias deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Aug 22, 2020
1 parent 405d27f commit 6613d95
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/models/concerns/indexable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -492,13 +492,11 @@ def list_aliases
# delete alias
def delete_alias(options={})
alias_name = options[:alias] || self.index_name
index_name = options[:index] || self.index_name + "_v1"
alternate_index_name = options[:index] || self.index_name + "_v2"
index_name = (options[:index] || self.index_name) + "_v1"
alternate_index_name = (options[:index] || self.index_name) + "_v2"

client = Elasticsearch::Model.client

self.__elasticsearch__.delete_index!(index: alias_name) if self.__elasticsearch__.index_exists?(index: alias_name)

# indexes in DOI model are aliased from DataciteDoi and OtherDoi models
# TODO switch to DataciteDoi index
# if self.name == "Doi"
Expand Down

0 comments on commit 6613d95

Please sign in to comment.