聚合分页在Elasticsearch中使用'from'和'size'

时间:2016-10-19 05:32:37

标签: elasticsearch aggregate

我想使用from和size属性进行分页结果。

但是,聚合中的'from'属性不支持表达式。

我可以采取其他方法吗?

查询语法:

{
  "size": 0,
    "query": {
        "bool": {
            "must": [{
                "match_phrase": {
                    "name": "John"
                }
            }]
        }
    },
  "aggs":{
    "dedup" : {
      "terms":{
        "field": "job",
        "from": 2, <<-- Is it possible??
        "size": 1
       },
       "aggs":{
         "dedup_docs":{
           "top_hits":{
             "size":1
           }
         }
       }
    }
  }
}

这是错误消息:

“type”:“search_parse_exception”

“reason”:“[dedup]中VALUE_NUMBER的未知密钥:[from]。”,

1 个答案:

答案 0 :(得分:0)

聚合无法使用“页面”归因。请检查'滚动'api。