3

Elasticsearch 1.4.0を使用して、集計機能を試しています。メッセージで SearchParseException を取得し続けますCannot find aggregator type [fieldName] in [aggregationName]

JSON 形式では、私のデータは次のようになります。

{ "userCode": "abcd123", "response": 1 }
{ "userCode": "abcd123", "response": 1 }
{ "userCode": "abcd123", "response": 0 }
{ "userCode": "wxyz123", "response": 0 }
{ "userCode": "wxyz123", "response": 0 }
{ "userCode": "wxyz123", "response": 1 }

2 人のユーザーがいて、abcd123それぞれwxyz123が 1 と 0 と応答した回数を数えたいだけです。このデータを SQL 選択構文で SQL テーブルに入れると、次のようになります (この SQL の場合例は、私がやろうとしていることを説明するのに役立ちます)。

select userCode, response, count(*) as total
from response_table
group by userCode, response

次のような結果セットが期待されます。

abcd123, 0, 1 //user abcd123 responded 0 once
abcd123, 1, 2 //user abcd123 responded 1 twice
wxyz123, 0, 2 //user wxyz123 responded 0 twice
wxyz123, 1, 1 //user wxyz123 responded 1 once

Elasticsearch の場合、集計 JSON は次のようになります。

{
 "aggs": {
  "users": {
   "terms": { "field": "userCode" },
   "aggs": {
    "responses" : {
     "terms": { "field": "response" }
    }
   }
  }
 }
}

ただし、 SearchParseException: が発生しCannot find aggregator type [responses] in [aggs]ます。私は何を間違っていますか?

参考になれば、私のマッピング ファイルは非常に単純で、次のようになります。

{
  "data": {
    "properties": {
      "userCode": {
        "type": "string",
        "store": "yes",
        "index": "analyzed",
        "term_vector": "no"
      },
      "response": {
        "type": "integer",
        "store": "yes",
        "index": "analyzed",
        "term_vector": "yes"
      }
    }
  }
}
4

1 に答える 1