aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility/elasticsearch_tools.py
diff options
context:
space:
mode:
authorMuriithi Frederick Muriuki2018-01-19 12:00:04 +0300
committerPjotr Prins2018-03-26 09:24:35 +0000
commit7959930d3276b5317d933a428a3c2f9ea8f7ddf4 (patch)
treedb7ab7431d19bd94d80309c532e1f1507238101f /wqflask/utility/elasticsearch_tools.py
parent38c85f80090322b2dc9278812b7b1f011bb35390 (diff)
downloadgenenetwork2-7959930d3276b5317d933a428a3c2f9ea8f7ddf4.tar.gz
Delay after save for indexing
* Elasticsearch need a short delay after adding document for it to index the document for subsequent access.
Diffstat (limited to 'wqflask/utility/elasticsearch_tools.py')
-rw-r--r--wqflask/utility/elasticsearch_tools.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/wqflask/utility/elasticsearch_tools.py b/wqflask/utility/elasticsearch_tools.py
index 74db489b..c2c999ea 100644
--- a/wqflask/utility/elasticsearch_tools.py
+++ b/wqflask/utility/elasticsearch_tools.py
@@ -22,8 +22,10 @@ def get_user_by_unique_column(column_name, column_value):
return user_details
def save_user(user, user_id, index="users", doc_type="local"):
+ from time import sleep
es = Elasticsearch([{
"host": ELASTICSEARCH_HOST
, "port": ELASTICSEARCH_PORT
}])
es.create(index, doc_type, body=user, id=user_id)
+ sleep(1) # Delay 1 second to allow indexing