Commit f9e596bd authored by Alessandro CERIONI's avatar Alessandro CERIONI
Browse files

Temporary commit.

parent 526116f5
...@@ -64,7 +64,8 @@ def reindexer(cfg): ...@@ -64,7 +64,8 @@ def reindexer(cfg):
while count1 != count2: while count1 != count2:
source_es.indices.refresh(index=cfg['reindexer']['source_index']) source_es.indices.refresh(index=cfg['reindexer']['source_index'])
count1 = source_es.count(cfg['reindexer']['source_index']).get('count') count1 = source_es.count(cfg['reindexer']['source_index']).get('count')
time.sleep(5) time.sleep(1)
source_es.indices.refresh(index=cfg['reindexer']['source_index'])
count2 = source_es.count(cfg['reindexer']['source_index']).get('count') count2 = source_es.count(cfg['reindexer']['source_index']).get('count')
rep = destination_es.reindex(body, wait_for_completion=False) rep = destination_es.reindex(body, wait_for_completion=False)
......
from elasticsearch import Elasticsearch
from lib.content_getter import get_posts_by_page from lib.content_getter import get_posts_by_page
from lib.content_processor import process_posts from lib.content_processor import process_posts
from lib.indexer import index_docs from lib.indexer import index_docs
from lib.reindexer import reindexer from lib.reindexer import reindexer
def main(): def main():
import yaml import yaml
...@@ -13,7 +16,13 @@ def main(): ...@@ -13,7 +16,13 @@ def main():
print('Starting...') print('Starting...')
#print(cfg) print('Deleting source index...')
es = Elasticsearch([cfg['reindexer']['source_url']])
try:
res = es.indices.delete(cfg['reindexer']['source_index'])
except:
pass
print('Getting posts...') print('Getting posts...')
pages = get_posts_by_page(cfg) pages = get_posts_by_page(cfg)
......
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