I have a Kibana graph showing a number of records where a value is >= the current date (specifically now/d
). I just happened to be testing a similar query in dev tools when I discovered that the number shown in Kibana or in the Discover search is off by a couple hundred from what the query shows. After lots of experimenting, I've determined that the only thing impacting the return count is the /d
in the date math. How are they calculating dates differently?
This Query:
GET my-index/_search
{
"size": 0,
"track_total_hits": true,
"query": {
"bool": {
"must": [
{
"range": {
"expiresAt": {
"gte": "now/d"
}
}
}
]
}
}
}
Returns this result:
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 64215,
"relation": "eq"
},
"max_score": null,
"hits": []
}
}
However, in Discover, I find that the exact same query returns only 64075 hits.