Created
October 20, 2018 02:04
-
-
Save Nick011/17870a853d593a75b8ac67b034d012e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
res = requests.get('http://localhost:9201/_cat/indices?format=json') | |
src_indices = res.json() | |
src_indices = [item['index'] for item in src_indices if not 'monitoring' in item['index']] | |
body = { | |
'source': { | |
'remote': { | |
'host': 'http://docker.for.mac.localhost:9201' | |
}, | |
'index': None | |
}, | |
'dest': { | |
'index': None | |
} | |
} | |
for index in src_indices: | |
body['source']['index'] = index | |
body['dest']['index'] = index | |
res = requests.post('http://localhost:9200/_reindex', json=body) | |
print(res.status_code) | |
print(res.json()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment