Skip to content
Browse files

Do not add indices to not empty alias (#1408)

* Do not add indices to not empty alias

Signed-off-by: Pavol Loffay <>

* rename

Signed-off-by: Pavol Loffay <>
  • Loading branch information...
pavolloffay committed Mar 7, 2019
1 parent e1fbd12 commit b5e2b65c690c3b4ed55e91f1afe1efb0570dc542
Showing with 16 additions and 2 deletions.
  1. +16 −2 plugin/storage/es/
@@ -85,8 +85,10 @@ def perform_action(action, client, write_alias, read_alias, index_to_rollover, t

index = index_to_rollover + '-000001'
create_index(client, index)
create_aliases(client, read_alias, index)
create_aliases(client, write_alias, index)
if is_alias_empty(client, read_alias):
create_aliases(client, read_alias, index)
if is_alias_empty(client, write_alias):
create_aliases(client, write_alias, index)
elif action == 'rollover':
cond = ast.literal_eval(os.getenv('CONDITIONS', ROLLBACK_CONDITIONS))
rollover(client, write_alias, read_alias, cond)
@@ -132,6 +134,18 @@ def create_aliases(client, alias_name, archive_index_name):

def is_alias_empty(client, alias_name):
Checks whether alias is empty or not
ilo = curator.IndexList(client)
if len(ilo.working_list()) > 0:
print("Alias {} is not empty. Not adding indices to it.".format(alias_name))
return False
return True

def rollover(client, write_alias, read_alias, conditions):
Rollover to new index and put it into read alias

0 comments on commit b5e2b65

Please sign in to comment.
You can’t perform that action at this time.