メインコンテンツへスキップ

Elasticsearchでインデックスの検索表示数を変える

·201 文字·1 分
inamuu
著者
inamuu
$ curl -s -XGET 'https://エンドポイント/index-2017.03.30/_search?pretty' | grep index | wc -l
10
$ curl -s -XGET 'https://エンドポイント/index-2017.03.30/_search?size=100&pretty'  | grep index | wc -l
100
$ curl -s -XGET 'https://エンドポイント/index-2017.03.30/_search?size=10000&pretty'  | grep index | wc -l
10000
$ curl -s -XGET 'https://エンドポイント/index-2017.03.30/_search?size=10001&pretty'
{
  "error" : {
    "root_cause" : [ {
      "type" : "query_phase_execution_exception",
      "reason" : "Result window is too large, from + size must be less than or equal to: [10000] but was [10001]. 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."
    } ],
    "type" : "search_phase_execution_exception",
    "reason" : "all shards failed",
    "phase" : "query_fetch",
    "grouped" : true,
    "failed_shards" : [ {
      "shard" : 0,
      "index" : "index-2017.03.30",
      "node" : "XXXXXXXXXXXXX",
      "reason" : {
        "type" : "query_phase_execution_exception",
        "reason" : "Result window is too large, from + size must be less than or equal to: [10000] but was [10001]. 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."
      }
    } ]
  },
  "status" : 500
}


$ curl -s -XGET 'https://エンドポイント/index-2017.03.30/_search?scroll=1m&size=200000&pretty' | grep index | wc -l
133118