Cannot invoke "Object.getClass()" because "right" is null when creating a TSVB with value_count

Hello,
I’ve created a rollup job for value count my documents from an index every day in order to have daily stats.
But when i create an TSVB visual with Value Count aggregation I get:

The request for this panel failed
Cannot invoke "Object.getClass()" because "right" is null
valueCount += vc } 
^---- HERE

image
If I use search api like this

{
    "aggs": {
        "types_count": {
            "value_count": {
                "field": "field_name.keyword"
            }
        }
    }
}

I get:

"aggregations": {
        "types_count": {
            "value": 10896409
        }
    }