pyes
pyes copied to clipboard
pyes.managers.Indices optimize method not optimizing
conn.indices.optimize(indices='logstash-2012.09.06', wait_for_merge=True, max_num_segments=1) {u'ok': True, u'_shards': {u'successful': 8, u'failed': 0, u'total': 8}}
In spite of "wait_for_merge" being set to true, it immediately returns and it does not optimize, even in the background.
I've taken to doing a GET call in urllib3 to do the optimize in the meanwhile.
Can you check if it works in the latest head? If not, what's the respective urllib3 call that works?
It still doesn't work. This is what I call:
#For some reason, this doesn't seem to work, though it should.'''
# conn.indices.optimize(indices=index, wait_for_merge=True, max_num_segments=1)
try:
r = http.request('GET', 'http://' + ESHOST + ':' + ESPORT + '/' + index + '/_optimize?max_num_segments=1')
except Exception, e:
logger.error("Unable to connect to URL http://" + ESHOST + ":" + ESPORT + "/_optimize?max_num_segments=1 " + str(e))
I pushed a small fix in case the optimize request parameters are case-sensitive though I can't really reproduce the problem before or after the fix. If it still doesn't work for you, can you post a self-contained test case?