Skip to content

Commit

Permalink
go
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Henderson committed Apr 26, 2022
1 parent 56cdbae commit 6e78374
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
21 changes: 16 additions & 5 deletions allocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,23 @@ def allocate_indices(client_config, index, index_allocation_policies):
allocation_type = key
if allocation_type != '':
# Change index allocation per policy
print("Changing allocation of index " + str(index) + \
" to " + str(allocation_type))
elastic_connection.indices.put_settings(
index=index,
body={"index.routing.allocation.require.box_type": allocation_type}
index_settings = elastic_connection.indices.get_settings(
index=index
)
index_settings = index_settings[index]['settings']['index']
box_type = 'hot'
if 'routing' in index_settings:
if 'allocation' in index_settings['routing']:
if 'require' in index_settings['routing']['allocation']:
if 'box_type' in index_settings['routing']['allocation']['require']:
box_type= index_settings['routing']['allocation']['require']['box_type']
if allocation_type != box_type:
print("Changing allocation of index " + str(index) + \
" to " + str(allocation_type))
elastic_connection.indices.put_settings(
index=index,
body={"index.routing.allocation.require.box_type": allocation_type}
)
elastic_connection.close()

def apply_allocation_to_indices(indices, index_allocation_policies, client_config):
Expand Down
2 changes: 1 addition & 1 deletion retention.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def apply_retention_policies(health_check_level, manual_client=""):
print("Processing retention for " + client_name)
# If client set at command line only run it otherwise
# execute for all clients
if limit_to_client == client_name or limit_to_client == "":
if limit_to_client == manual_client or limit_to_client == "":
while retry_count >= 0 and success == 0:
# Check cluster health - Expect Yellow to continue
if es.check_cluster_health_status(client_config, health_check_level):
Expand Down

0 comments on commit 6e78374

Please sign in to comment.