Date doesn't seem to work with date_histogram

We've made a template that has:

"properties": {
"timestamp": {
"type": "date",
"format": "epoch_second"
},

When reading the _mapping we get:

"timestamp": {
"type": "long"
}

We are unable to do date_histogram, as it aggregates by all and not by day as it should be:

"date_histogram": {
"field": "timestamp",
"interval": "day"
}

Is the "long" time ok? How can we histogram on this?

It sounds like your template is not being applied correctly, or some data was indexed before the template was put in place. I'd try to get that sorted so that the data is properly mapped as a date. Internally it's just a long, but having correct mapping will make your life a lot easier.

Perhaps the syntax on your template is incorrect, or not matching the right pattern? Can you verify that it was in place before any data was indexed?

Yes you were right! Thanks!

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