We need to have a date histogram aggregation with week interval, with week starting on Sunday instead of the Monday which Elasticsearch defaults to. I'm running Elasticsearch version 5.3.0.
I found this Github issue which added pre_offset and post_offset, but it does not seem to work for me: https://github.com/elastic/elasticsearch/issues/1599
Here is the aggs portion of my query:
"aggs": {
"a1": {
"date_histogram": {
"field": "postedDate",
"interval": "week",
"pre_offset": "-1d",
"post_offset": "-1d",
"order": {
"_key": "asc"
}
}
}
}
Running the query fails with:
Error: [illegal_argument_exception] [date_histogram] unknown field [pre_offset], parser not found
The query runs fine without the pre_offset/post_offset fields. Did I put those properties in the right place? They don't seem to be documented anywhere aside from the aforementioned GitHub issue. Is it still supported, and if not, how else can one set the week start to be Sunday instead of Monday?