Skip to content

Commit

Permalink
Do not try to change the settings for indexes where previousVersion e…
Browse files Browse the repository at this point in the history
…quals 0, it will never exist!
  • Loading branch information
Mraoul committed Apr 7, 2016
1 parent b7c09c0 commit d709b7a
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions pydat/scripts/elasticsearch_populate.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,14 +510,15 @@ def unOptimizeIndexes(es, template, options):
index_name += "-o"

try:
es.indices.put_settings(index="%s-%s-d" % (options.index_prefix, options.previousVersion),
body = {"settings": {
"index": {
"number_of_replicas": template['settings']['number_of_replicas'],
"refresh_interval": template['settings']["refresh_interval"]
if options.previousVersion != 0:
es.indices.put_settings(index="%s-%s-d" % (options.index_prefix, options.previousVersion),
body = {"settings": {
"index": {
"number_of_replicas": template['settings']['number_of_replicas'],
"refresh_interval": template['settings']["refresh_interval"]
}
}
}
})
})
except Exception as e:
pass

Expand All @@ -543,14 +544,15 @@ def optimizeIndexes(es, options):
index_name += "-o"

try:
es.indices.put_settings(index= "%s-%s-d" % (options.index_prefix, options.previousVersion),
body = {"settings": {
"index": {
"number_of_replicas": 0,
"refresh_interval": "300s"
if options.previousVersion != 0:
es.indices.put_settings(index= "%s-%s-d" % (options.index_prefix, options.previousVersion),
body = {"settings": {
"index": {
"number_of_replicas": 0,
"refresh_interval": "300s"
}
}
}
})
})
except Exception as e:
pass

Expand Down

0 comments on commit d709b7a

Please sign in to comment.