python 查询ElasticSearch 中索引的doc
作者:
HAO延WEI | 来源:发表于
2020-05-13 11:14 被阅读0次from elasticsearch import Elasticsearch, helpers
def elasticsearch(index):
es = Elasticsearch(['http://localhost:80'],
sniff_on_start=True,
sniff_on_connection_fail=True,
sniff_timeout=60)
es.cluster = "bdp-es6"
data = es.count(index=index, doc_type="reptile")
print data
if data:
return data['count']
if __name__ == '__main__':
elasticsearch("test")
效果
本文标题:python 查询ElasticSearch 中索引的doc
本文链接:https://www.haomeiwen.com/subject/ldtnnhtx.html
网友评论