2017-09-12 119 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