elasticsearch-py scan and scroll to return all documents

后端 未结 2 1644
星月不相逢
星月不相逢 2021-02-07 01:38

I am using elasticsearch-py to connect to my ES database which contains over 3 million documents. I want to return all the documents so I can abstract data and write it to a csv

2条回答
  •  广开言路
    2021-02-07 02:11

    Do you issue got resolved ?

    I have got one simple solution, you must change the scroll_id every time after you call scroll method like below :

    response_tmp = es.scroll(scroll_id=scrollId, scroll= "1m")
    
    scrollId = response_tmp['_scroll_id']
    

提交回复
热议问题