我正在尝试使用 haystack 遍历搜索查询集,但它抛出了这个错误:
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.
有没有办法遍历所有索引元素? (假设我有几百万条记录)。
请您参考如下方法:
max_result_window 是一个索引设置,您可以根据需要更改它,但大多数情况下您不必这样做,因为如果您想使用搜索 API 遍历所有文档,那不是您应该采用的方式. 尝试使用扫描和滚动 api。
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html
个人注意事项:我将 elasticsearch 与 django 一起使用,我发现 haystack 与 elasticsearch-dsl 相比难以使用。尝试查看 elasticsearch-dsl-py。 https://github.com/elastic/elasticsearch-dsl-py
