Stats aggregation returning inconsistent results

Using version 7.9.2

curl -X POST 172.31.26.133:9200/5cab6838-5c3a-455d-9486-a708f6cb20a7/_search --data-raw '{"aggs":{"Stats":{"stats":{"field":"Date & Time"}}},"size":0}' -H 'content-type: application/json'
{
    "took": 0,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 0,
            "relation": "eq"
        },
        "max_score": null,
        "hits": []
    },
    "aggregations": {
        "Stats": {
            "count": 0,
            "min": null,
            "max": null,
            "avg": null,
            "sum": 0.0
        }
    }
}
curl -X POST 172.31.26.133:9200/5cab6838-5c3a-455d-9486-a708f6cb20a7/_search --data-raw '{"aggs":{"Stats":{"stats":{"field":"Date & Time"}}},"size":0}' -H 'content-type: application/json'
{
    "took": 0,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 162,
            "relation": "eq"
        },
        "max_score": null,
        "hits": []
    },
    "aggregations": {
        "Stats": {
            "count": 162,
            "min": 1199232000000.0,
            "max": 1204502400000.0,
            "avg": 1201575466666.6667,
            "sum": 194655225600000.0,
            "min_as_string": "2008-01-02T00:00:00.000",
            "max_as_string": "2008-03-03T00:00:00.000",
            "avg_as_string": "2008-01-29T02:57:46.666",
            "sum_as_string": "8138-05-19T00:00:00.000"
        }
    }
}

These are back to back identical calls returning two different results.

Date & Time is mapped as: "Date & Time":{"type":"date","format":"date_hour_minute_second_millis||epoch_millis"}

I would expect this to return consistent results.

This inconsistent behavior was caused by the index settings refresh_interval set to a value of -1.

We set the refresh_interval to -1 when we populate a new index with a lot of records then we set it to 30s afterwards. Apparently, this settings change didn't happen for this dataset.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.