Skip to content

Commit

Permalink
account for old versions of es
Browse files Browse the repository at this point in the history
  • Loading branch information
genevera committed Apr 8, 2019
1 parent ae03e14 commit ac16f66
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion curator/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1890,6 +1890,10 @@ def __init__(self, ilo, shrink_node='DETERMINISTIC', node_filters={},
if extra_settings:
self._merge_extra_settings(extra_settings)

self.shrink_copy_settings = {'copy_settings': 'true'}
if utils.get_version(self.client) < (6,4,3):
self.shrink_copy_settings = ''

def _merge_extra_settings(self, extra_settings):
self.loggit.debug(
'Adding extra_settings to shrink body: '
Expand Down Expand Up @@ -2151,7 +2155,8 @@ def do_action(self):
# Do the shrink
self.loggit.info('Shrinking index "{0}" to "{1}" with settings: {2}, wait_for_active_shards={3}'.format(idx, target, self.body, self.wait_for_active_shards))
try:
self.client.indices.shrink(index=idx, params={'copy_settings':'true'}, target=target, body=self.body, wait_for_active_shards=self.wait_for_active_shards)

self.client.indices.shrink(index=idx, params=self.shrink_copy_settings, target=target, body=self.body, wait_for_active_shards=self.wait_for_active_shards)
self.loggit.debug('unblocking writes on {0}'.format(target))
self._unblock_writes(target)
self.loggit.debug('undoing route reqs for {0}'.format(target))
Expand Down

0 comments on commit ac16f66

Please sign in to comment.