Commit 26d4b66a authored by Alessandro CERIONI's avatar Alessandro CERIONI
Browse files

Adding missing module to the Git repo.

parent ef306763
from elasticsearch import Elasticsearch
def index_cleaner( cfg, post_id=None ):
source_es = Elasticsearch([cfg['reindexer']['source_url']])
destin_es = Elasticsearch([cfg['reindexer']['destination_url']])
# Cleaning up the ingest and digest indexes...
if post_id == None:
print('Deleting the ingest and digest indexes...')
try:
res = source_es.indices.delete(cfg['reindexer']['source_index'])
except Exception as e:
print(e)
try:
rep = destin_es.indices.delete(cfg['reindexer']['destination_index'])
#print(rep)
except Exception as e:
print(e)
else:
print('Deleting post with uuid=%s from the ingest and digest index...' % post_id)
the_query = {
"query": {
"match": {
"uuid.keyword": post_id
}
}
}
try:
res = source_es.delete_by_query(index=cfg['reindexer']['source_index'], doc_type='_doc', body=the_query)
#print(res)
except Exception as e:
print(e)
try:
res = destin_es.delete_by_query(index=cfg['reindexer']['destination_index'], doc_type='_doc', body=the_query)
#print(res)
except Exception as e:
print(e)
#exit(1)
return
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment