Hi
I just want to apply aggregation on a query result. My query is eleminating the double documents keeping last one according to a clumn. But the aggragation doesn't care the actual result. I've read that the collapse doesn't affect the aggragation. I could't find a way to do that!
GET /db-oracle-kys-aktarim-*/_search?size=0
{
"query": {
"bool": {
"must": [
{"range": {"islemtarih":{"gte":"now/d"}}},
{"match_phrase": {
"islemyapan": "pasaport"
}}
]
}
},
"collapse": {
"field": "kayitno"
},
"sort": [
{
"islemtarih": {
"order": "desc"
}
}
],
"from": 0,
"aggs": {
"categories": {
"terms": {
"field": "aciklama.keyword"
}
}
}
}
and the result is,
"aggregations" : {
"categories" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "Baþarili",
"doc_count" : 4598
},
{
"key" : "Beklemede",
"doc_count" : 4474
}
]
}
}
but it must be,
"aggregations" : {
"categories" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "Baþarýlý",
"doc_count" : 4598
},
{
"key" : "Beklemede",
"doc_count" : 30
}
]
}
}
because of doubled documents!