Guys,
Please point me to right direction.
I'm trying to create very simple aggregation query, based on tiny array of data. For that I'm using kopf's rest interface. As far as I can understand, this query is not groovy (or other) script, which I have to enable explicitly.
So:
GET /transactions/sales/_search:
{
"query": {
"match_all": {}
}
}
Response:
{
"took": 6,
"timed_out": false,
"_shards": {
"total": 2,
"successful": 2,
"failed": 0
},
"hits": {
"total": 4,
"max_score": 1,
"hits": [
{
"_index": "transactions",
"_type": "sales",
"_id": "3",
"_score": 1,
"_source": {
"type": "cost",
"amount": 30
}
},
{
"_index": "transactions",
"_type": "sales",
"_id": "1",
"_score": 1,
"_source": {
"type": "sale",
"amount": 80
}
},
{
"_index": "transactions",
"_type": "sales",
"_id": "2",
"_score": 1,
"_source": {
"type": "cost",
"amount": 10
}
},
{
"_index": "transactions",
"_type": "sales",
"_id": "4",
"_score": 1,
"_source": {
"type": "sale",
"amount": 130
}
}
]
}
}
It looks like we are good. However:
{
"size": 0,
"aggs": {
"sales_types": {
"terms": {
"field": "type"
}
}
}
}
The result is the same as above. However, I expected something like this (below response was taken from example):
{
"took": 40,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 4,
"max_score": 0,
"hits": []
},
"aggregations": {
"sales_types": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "cost",
"doc_count": 2
},
{
"key": "sale",
"doc_count": 2
}
]
}
}
}
Kindly please advise.
Thank you,
ignaqui