First day of the week


(Lorenzo) #1

Hello

I'm trying to create a new visualization, vertical bar chart, with time in the x-axis.
Here the request Kibana is doing:

{
"query": {
"filtered": {
"query": {
"query_string": {
"query": "*",
"analyze_wildcard": true
}
},
"filter": {
"bool": {
"must": [
{
"query": {
"query_string": {
"analyze_wildcard": true,
"query": "MERCH_YEAR:2016"
}
}
}
],
"must_not": []
}
}
}
},
"size": 0,
"aggs": {
"2": {
"date_histogram": {
"field": "DAY",
"interval": "1w",
"time_zone": "Europe/Berlin",
"min_doc_count": 1,
"extended_bounds": {
"min": 1465829368033,
"max": 1465830268033
}
},
"aggs": {
"3": {
"terms": {
"field": "ZONE",
"size": 14,
"order": {
"_term": "asc"
}
},
"aggs": {
"1": {
"sum": {
"field": "SALES_EURO"
}
}
}
}
}
}
}
}

The aggregation considers Monday as first day of the week.

How can I change this behavior in order to have Sunday as first day of the week and to have sales metric aggregated from Sunday to Saturday for each week?

Thank you
Lorenzo


(Joe Fleming) #2

According to the ISO 8601 standard, Monday is the official first day of the week. Notable exceptions to this are the US and Canada, which treat Sunday as the first day of the week.

"time_zone": "Europe/Berlin",

I suspect that because your timezone location is Berlin that the date parsing library we're using is falling back to the ISO 8601 standard, and thus you are seeing Monday as the first day of the week. I don't believe there's a workaround for this in Kibana currently. I'd encourage you to open an issue to request this functionality, perhaps as an advanced setting or something.


(system) #3