Create nested hour field in date field

Hi.

Is it possible to create hour field inside of date field on indexing time?

  "properties": {
    "time": {
      "format": "yyyy-MM-dd HH:mm:ss Z",
      "type": "date"
    }
  }

With mapping above I expect something like below.

  "properties": {
    "time": {
      "format": "yyyy-MM-dd HH:mm:ss Z",
      "type": "date",
          "fields": {
            "hour": {
              "format": "HH",
              "type": "date or.. integer
            }
         }
    }
  }

so that it will have hour field

{
 "time" : "2016-08-10 14:23:44 +0000",
 "time.hour" : "14"
}

I am aware of a way that using scripted field.

You'd need to pass it in during indexing I think.

1 Like

This need is a kind of to get date aggregation.
something like DAY_OF_WEEK agg, HOUR_OF_DAY agg.

Since es does not support this for now, I will pass pre formatted hour, day values.

Thanks @warkolm .