From ac16f66ae401b476bfbe4c1ac3bec0703d5cb58e Mon Sep 17 00:00:00 2001 From: genevera Date: Sun, 7 Apr 2019 22:46:32 -0400 Subject: [PATCH] account for old versions of es --- curator/actions.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/curator/actions.py b/curator/actions.py index b0853029..3f8d7d9f 100644 --- a/curator/actions.py +++ b/curator/actions.py @@ -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: ' @@ -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))