The matrix_stats aggregation treats each document field as an independent sample. The mode parameter controls what
array value the aggregation will use for array or multi-valued fields. This parameter can take one of the following:

The missing parameter defines how documents that are missing a value should be treated.
By default they will be ignored but it is also possible to treat them as if they had a value.
This is done by adding a set of fieldname : value mappings to specify default values per field.