Commit 069679c8 authored by litaolemo's avatar litaolemo

update

parent 9fab267a
This diff is collapsed.
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# @email : litao@igengmei.com # @email : litao@igengmei.com
# @author : litao # @author : litao
from elasticsearch import Elasticsearch from elasticsearch import Elasticsearch
exists_es_dic = {}
es = Elasticsearch([ es = Elasticsearch([
{ {
'host': '172.16.31.17', 'host': '172.16.31.17',
...@@ -16,6 +16,9 @@ es = Elasticsearch([ ...@@ -16,6 +16,9 @@ es = Elasticsearch([
def get_device_num_from_es(word): def get_device_num_from_es(word):
if word in exists_es_dic:
return exists_es_dic[word]
results = es.search( results = es.search(
index='gm-dbmw-device', index='gm-dbmw-device',
doc_type='doc', doc_type='doc',
...@@ -159,6 +162,7 @@ def get_device_num_from_es(word): ...@@ -159,6 +162,7 @@ def get_device_num_from_es(word):
} }
) )
tractate_content_num = results["hits"]["total"] tractate_content_num = results["hits"]["total"]
exists_es_dic[word] = tractate_content_num
return tractate_content_num return tractate_content_num
......
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