弹性搜索中的简单组

时间:2015-08-17 19:51:22

标签: elasticsearch

这是我的搜索:

{
 "query": {
   "filtered": { 
     "filter": {
       "term": { "cityId": "10777"}
     },
     "query" : {
        "query_string": {
          "query": "pizza",
          "fields": ["name", "main", "category.name"]
        }
      }
   }
 },
 "sort": [
        { "premium":   { "order": "desc" } }
    ]
}

这完美无缺。 他给我带来了几个类别,我想按他们分组。 例: 按类别分类“比萨店”

1 个答案:

答案 0 :(得分:2)

您所要做的就是在混音中添加terms aggregation,然后就完成了。

假设您的类别字段是cloning into 'MYPROJECT'... permissions denied (publickey). fatal: Could not read from remote repository Please make sure you have the correct access rights and the repository exists. ,您可以这样做。

category.name