您可以使用scan()
helper函数来从test
索引中检索所有文档:
from elasticsearch import Elasticsearch, helpers
client = Elasticsearch(
[
#'http://user:secret@10.x.x.11:9200/',
'http://10.x.x.11:9200/',
],
verify_certs=True
)
docs = list(helpers.scan(client, index="test", query={"query": {"match_all": {}}}))
for hit in docs:
print hit.message_id, hit.severity, "\n\n"