Min_bucket date format does not work

Hi,

I am trying to format of a result of a min_bucket. (I want to get the minimum of maximum date by datasource, which is working well.)

GET my-index/_search
{
  "size": 0,
  
  "aggs": {
    "source": {
      "terms": {
        "field": "datasource",
        "size": 10
      },
      "aggs": {
        
        "maxdate": {
          
          "max": {
            "field": "my-timestamp",
            "format": "yyyy-MM-dd"
          }
        }
      }
      
    }
    ,
    
    "min_datez": {
      
      "min_bucket": {

        "buckets_path": "source>maxdate",
        "format": "date_time"
      }
    }
  }
}

Result:

...
"min_datez": {
      "value": 1533074400000,
      "value_as_string": "date_time1533074400000",
      "keys": [
        "some-key-1"
      ]
    }

I think formatting of "value_as_string" is wrong. How should I do date formatting in this case?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.