ValuesSourceType is roughly the type of data that the aggregator expects to work with. For example,
ValuesSourceType.NUMERIC because it only works with numeric fields.
ValuesSourceType.ANY is sort of a wildcard that means the aggregator can accept type of field. The
missing aggregator is a good example: it doesn't really care what the data type is, it's just looking to see if the doc is missing a value or not.
That's a rough approximation, it's a little more complicated because the VS Type is used in a few different places. The main location is
ValuesSourceConfig#resolve(), and helps resolve what kind of field data implementation we should load. Scripting,
value_type parameters on the agg affect this decision too.
And to head off an obvious followup question,
ValueType sorta maps the VSType, formatter and field data implementation to a specific field type. E.g. a
double field have different
ValueTypes, but both of those ValueTypes map to a ValuesSourceType.Numeric.
It's all a bit confusing and an area we're actively trying to refactor