2015-04-02 55 views
3

有辦法獲得前n項結果。例如:期限彙總的限制和抵消ElasticSearch

{ 
 
    "aggs": { 
 
    "apiSalesRepUser": { 
 
     "terms": { 
 
     "field": "userName", 
 
     "size": 5 
 
     } 
 
    } 
 
    } 
 
}

有什麼辦法來設置的偏移量方面的結果?

+0

http://www.elastic.co/guide/en/elasticsearch/reference/1.4/search-request-from-size.html也許使用'from'? (聚合中的http://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-top-hits-aggregation.html#_options_2) – Utopik 2015-04-02 14:32:57

+0

@Utopik這不適用於聚合。它僅適用於返回的匹配。 – bittusarkar 2015-04-03 05:13:17

回答

2

如果您的意思是先忽略m結果並返回下一個n結果然後否;這不可能。解決方法是將size設置爲m + n,然後執行客戶端處理以忽略第一個m結果。