Closed
Description
Elasticsearch version: 7.9.1 (reproducible on demo.elastic.co)
Description of the problem including expected versus actual behavior:
The response to the exact same search request sometimes contains the cardinality aggregation and sometimes it doesn't - the issue is transient.
Steps to reproduce:
The following request (on demo.elastic.co):
POST _search?request_cache=false
{
"aggs": {
"date_range": {
"aggs": {
"unique_users": {
"cardinality": {
"field": "agent.name"
}
}
},
"date_range": {
"field": "@timestamp",
"ranges": [
{
"from": "2020-09-01T00:00:00.000000+00:00"
}
]
}
}
},
"query": {
"bool": {
"must": [
{
"terms": {
"agent.id": []
}
}
]
}
}
}
Results in:
{
"took" : 962,
"timed_out" : false,
"_shards" : {
"total" : 480,
"successful" : 480,
"skipped" : 477,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 0,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"date_range" : {
"buckets" : [
{
"key" : "2020-09-01T00:00:00.000Z-*",
"from" : 1.5989184E12,
"from_as_string" : "2020-09-01T00:00:00.000Z",
"doc_count" : 0,
"unique_users" : {
"value" : 0
}
}
]
}
}
}
And other times in
{
"took" : 444,
"timed_out" : false,
"_shards" : {
"total" : 480,
"successful" : 480,
"skipped" : 478,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 0,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"date_range" : {
"buckets" : [
{
"key" : "2020-09-01T00:00:00.000Z-*",
"from" : 1.5989184E12,
"from_as_string" : "2020-09-01T00:00:00.000Z",
"doc_count" : 0
}
]
}
}
}
Notice the unique_users
metric missing from the second response. It doesn't take more than a few tries to get both responses.