I want to add a year/month column like i could with json. But I get the following issues:
1. Date-type field is shown as string.
2. Year / month (numeric) fields has random ordering
3. Month (label) field didn't test, but probably need ordering
Hello, Abons,
Thank you for writing to us.
To modify dates representation in Elasticsearch we suggest configuring the mapping
object: https://www.flexmonster.com/doc/configuring-the-mapping/.
Please pay attention to an interval
property which is used to set intervals. One more important property is a format
. For example, if you have a field named date
, here is how to set an interval
to 1 month and specify a format
:
mapping: {
"date": {
"interval": "1M",
"format": "MM/yyyy"
}
}
This doc specifies different interval options: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-datehistogram-aggregation.html#_setting_intervals.
Hope it helps.
Regards,
Tanya