Setting Elastic search limit to “unlimited”

后端 未结 4 1628
执笔经年
执笔经年 2020-12-08 04:02

How can i get all the results from elastic search as the results only display limit to 10 only. ihave got a query like:

@data = Athlete.search :load => tr         


        
4条回答
  •  旧巷少年郎
    2020-12-08 04:32

    From the docs, "Note that from + size can not be more than the index.max_result_window index setting which defaults to 10,000". So my admittedly very ad-hoc solution is to just pass size: 10000 or 10,000 minus from if I use the from argument.

    Note that following Matt's comment below, the proper way to do this if you have a larger amount of documents is to use the scroll api. I have used this successfully, but only with the python interface.

提交回复
热议问题