2014-10-31 85 views

回答

0

试试这个,使用top_hits aggregation

GET /machines/_search?search_type=count 
{ 
    "query": { 
    "match_all": {} //your query here 
    }, 
    "aggs": { 
    "top-types": { 
     "terms": { 
     "field": "_type" 
     }, 
     "aggs": { 
     "top_docs": { 
      "top_hits": { 
      "sort": [ 
       { 
       "_score": { 
        "order": "desc" 
       } 
       } 
      ], 
      "size": 1 
      } 
     } 
     } 
    } 
    } 
} 
+0

让我试试这个和更新 - 感谢您的答案 – bx5974 2014-11-09 09:31:01

相关问题