Elasticsearch: Hour of the day/Day of the week/Week of the month/Month of the year aggregation

Created on 14 May 2017  路  3Comments  路  Source: elastic/elasticsearch

I've come across a few users wanting to do day of the week type aggs. eg _"Show me the total number of logs that occurred at 0200 on each day for the last 28 days"_, or _"what is the average/mean/max/sum, by day of the week, for all transactions for this financial year"_.

You can already easily do this on a per day basis, that is for each day of the week/month/year, using a date agg. But that will not do a bucket to group all Mon/Tues/Wed/etc to grab those metrics.

Note - a script agg can do this and here's a good example.

I think this could potentially be a useful inbuilt function of the existing date range agg or a pipeline agg (or some other agg), so wanted to open it up for further discussion.

:AnalyticAggregations >docs good first issue help wanted

All 3 comments

Discussed in Fix it Friday - a scripted terms aggregation is the right way to go here, and can also be used in Kibana.

We should add documentation to the date histogram page demonstrating how to do this.

I would like to try this as my first PR, if it seems like a good starting point

Hi, can you have a look on the documentation added?
Is that what you're proposing?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

clintongormley picture clintongormley  路  3Comments

dadoonet picture dadoonet  路  3Comments

clintongormley picture clintongormley  路  3Comments

matthughes picture matthughes  路  3Comments

makeyang picture makeyang  路  3Comments