CMS-4698 Extend DateHistogramAggregation with keyAsInstant

Added, also refactored some factories and moved tests