Skip to content

Commit

Permalink
added es_timeout for AWS ES and moved ingest_pipeline to inside with …
Browse files Browse the repository at this point in the history
…block (#47)
  • Loading branch information
DustinKLo authored Jun 8, 2021
1 parent d266c9f commit c9c0c30
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
5 changes: 4 additions & 1 deletion grq2/es_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ def get_grq_es(logger=None):
connection_class=RequestsHttpConnection,
use_ssl=True,
verify_certs=False,
ssl_show_warn=False
ssl_show_warn=False,
timeout=30,
max_retries=10,
retry_on_timeout=True,
)
else:
GRQ_ES = ElasticsearchUtility(es_url, logger)
Expand Down
16 changes: 10 additions & 6 deletions scripts/install_ingest_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@
ingest_file = os.path.abspath(ingest_file)
ingest_file = os.path.normpath(ingest_file)

with open(ingest_file) as f:
pipeline_settings = json.load(f)
print(json.dumps(pipeline_settings, indent=2))

pipeline_name = 'dataset_pipeline'
if __name__ == '__main__':
# TODO: delete pipeline here with a try except

# https://elasticsearch-py.readthedocs.io/en/master/api.html#elasticsearch.client.IngestClient
grq_es.es.ingest.put_pipeline(id=pipeline_name, body=pipeline_settings, ignore=400)
with open(ingest_file) as f:
pipeline_settings = json.load(f)
print(json.dumps(pipeline_settings, indent=2))

pipeline_name = 'dataset_pipeline'

# https://elasticsearch-py.readthedocs.io/en/master/api.html#elasticsearch.client.IngestClient
grq_es.es.ingest.put_pipeline(id=pipeline_name, body=pipeline_settings, ignore=400)

0 comments on commit c9c0c30

Please sign in to comment.