多字段搜索和按字段组织

时间:2014-05-12 13:13:31

标签: elasticsearch

我试图匹配elasticsearch中的许多字段,然后从每个字段中分组

E.g:

我有5个字段是“Team_Wii”,“Team_PS4”,“Team_XBOX”,“Emp_Microsoft”,“Emp_Teste”。

所有字段都是布尔值,并且有许多带有true或false的条目

我想知道我如何组织这些字段以返回每个字段的出现次数。

我的查询:

{
  "facets": {
    "Match Team": {
      "query": {
        "multi_match": {
          "query": "true",
          "fields": [
            "Team_*"
          ]
        }
      }
    }
  }
}

输出:

    hits:{
    total: 24173305,
    max_score: 1,
    hits:[...]
facets: {
Match Team: {
_type: query
count: 111343
}
}

我想要输出的内容:

hits:{
total: 24173305,
max_score: 1,
hits:[...]
Facets:{
Team_wii:{
Count: 2837}
Team_PS4:{
Count: 651}
Team_XBOX:{
Count: 321}

0 个答案:

没有答案