Date_histogram with date range date type is text

{
"query": {
"range": {
"created_ts": {
"from": "2018-03-28",
"to": "2019-07-28"
}
}
},
"aggs": {
"group_by_created_ts": {
"date_histogram": {
"field": "created_ts",
"interval": "day",
"format": "yyyy-MM-dd"
}
}
}
}

getting error
"reason": {
"type": "illegal_argument_exception",
"reason": "Field [created_ts] of type [text] does not support custom formats"
}

Change your mapping and make that field a date field.

ok, Then without drooping index , can change text to date?

No. You need to reindex.

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