Cardinality aggregation fails in case of empty doc values field

In case a doc values field doesn't have values all the time the cardinality aggregation can fail with a ArrayIndexOutOfBoundsException.