Elasticsearch分页不起作用(至少不能以自然理解的方式进行)

时间:2019-07-03 18:40:55

标签: elasticsearch

我的索引中有大约38,000个文档。根据Elasticsearhc,我一次只能查询10,000。

此查询有效:

GET /vendor/vendors/_search
{
  "from": 0,
  "size": 10000,
  "_source": ["_id", "name", "vendor_type"],
  "query": {
      "match_all": {}
  },
  "sort": {
    "weight": {
      "order": "desc"
    }
  }
}

此查询没有!如果我什至无法获得接下来的10个文档,我应该如何获得接下来的10,000个文档?

给出错误

type": "query_phase_execution_exception",
        "reason": "Result window is too large, from + size must be less than or equal to: [10000] but was [10010]. 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 setting."

此查询

 GET /vendor/vendors/_search
    {
      "from": 10000,
      "size": 10,
      "_source": ["_id", "name", "vendor_type"],
      "query": {
          "match_all": {}
      },
      "sort": {
        "weight": {
          "order": "desc"
        }
      }
    }

1 个答案:

答案 0 :(得分:0)

使用滚动API,我能够做我需要做的事情。