Fetch all the rows using elasticsearch_dsl

孤者浪人 提交于 2019-12-02 06:44:52

You can use the scan() helper function in order to retrieve all docs from your test index:

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"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!