aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility/elasticsearch_tools.py
diff options
context:
space:
mode:
authorMuriithi Frederick Muriuki2018-01-19 12:00:04 +0300
committerMuriithi Frederick Muriuki2018-01-19 12:00:04 +0300
commite185fd3895473e86f2c9fdf174a36b1d325a8c36 (patch)
tree7f72d42049439f39bdbcaa6eec07cc81400ff4d4 /wqflask/utility/elasticsearch_tools.py
parent4ae020160a9ae9c399fe338c9415897b26425201 (diff)
downloadgenenetwork2-e185fd3895473e86f2c9fdf174a36b1d325a8c36.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