2017-09-12 81 views
2

我试图遍历一个搜索查询集与草垛,但它抛出我这个错误:Django的干草堆:如何遍历所有索引元素

Result window is too large, from + size must be less than or equal to: [10000] but was [11010]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level parameter.

有没有办法来遍历所有索引元素? (假设我有几百万条记录)。

回答

1

max_result_window是一个索引设置,如果你想,但大多数时候,你不必,因为如果你想重复您的全部使用搜索API的文档,你可以改变是不是你应该的样子走。 尝试用扫描和滚动API。

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html

和个人笔记:我用elasticsearch Django的,我发现草垛难用,而不是elasticsearch-DSL。试着看看elasticsearch-dsl-py。 https://github.com/elastic/elasticsearch-dsl-py