jillesvangurp / kt-search

Multi platform kotlin client for Elasticsearch & Opensearch with easily extendable Kotlin DSLs for queries, mappings, bulk, and more.
MIT License
95 stars 23 forks source link

[FEAT] Date format in date histogram aggregation #68

Closed jelle-blaauw closed 1 year ago

jelle-blaauw commented 1 year ago

Describe the enhancement

I'd like to be able to choose the date format in a DateHistogramAgg.

Why is this needed?

It's an ElasticSearch feature, so it should be in this lib as well.

How do you think it should be done?

The property format should be added to the DateHistogramAggConfig class, like so:

class DateHistogramAggConfig : JsonDsl() {
    var field by property<String>()
    var calendarInterval by property<String>("interval")
    var format by property<String>("format") // <--
    var minDocCount by property<Long>("min_doc_count")
}

Will you be able to help with a pull request?

Yes.