Questions tagged [date-histogram]

A multi-bucket aggregation similar to the histogram except it can only be applied on date values.

Since dates are represented in elasticsearch internally as long values, it is possible to use the normal histogram on dates as well, though accuracy will be compromised. The reason for this is in the fact that time based intervals are not fixed (think of leap years and on the number of days in a month). For this reason, we need special support for time based data. From a functionality perspective, this histogram supports the same features as the normal histogram. The main difference is that the interval can be specified by date/time expressions.

45 questions
10
votes
4 answers

Elasticsearch average over date histogram buckets

I've got a bunch of documents indexed in ElasticSearch, and I need to get the following data: For each month, get the average number of documents per working day of the month (or if impossible, use 20 days as the default). I already aggregated my…
Thibault J
  • 4,336
  • 33
  • 44
6
votes
3 answers

Cardinality over Date Histogram

What would be the best way to query Elasticsearch in order to implement a date histogram representing the total number of unique visitors metric? Considering the following data: PUT /events { "mappings" : { "_doc" : { …
AndreLDM
  • 2,117
  • 1
  • 18
  • 27
6
votes
2 answers

Dynamic time zone offset in elasticsearch aggregation?

I'm aggregating documents that each have a timestamp. The timestamp is UTC, but the documents each also have a local time zone ("timezone": "America/Los_Angeles") that can be different across documents. I'm trying to do a date_histogram aggregation…
5
votes
1 answer

Using date_histogram with fixed_interval (30d) unexpected bucket start

I have a requirement to get data aggregated per 30 days (not month) so I'm using a date_histogram with "fixed_interval": "30d" to get that data. For example, if the user wants the last 90 days aggregations, there should be 3 buckets: [90-60, 60-30,…
4
votes
1 answer

Showing hourly average (histogramm) in grafana

Given a timeseries of (electricity) marketdata with datapoints every hour, I want to show a Bar Graph with all time / time frame averages for every hour of the data, so that an analyst can easily compare actual prices to all time averages (which…
Jürgen Zornig
  • 1,174
  • 20
  • 48
4
votes
2 answers

Elasticsearch - calculate percentage in nested aggregations in relation to parent bucket

Updated question In my query I aggregate on date and then on sensor name. It is possible to calculate a ratio from a nested aggregation and the total count of documents (or any other aggregation) of the parent bucket? Example query: { "size": 0, …
static-max
  • 739
  • 10
  • 19
3
votes
2 answers

Elasticsearch: Aggregate documents based on date range

I have a set of documents in ElasticSearch 5.5 with two date fields: start_date and end_date. I want to aggregate them into date histogram buckets (ex: weekly) such that if the start_date < week X < end_date, then document would be in "week X"…
3
votes
1 answer

Elastic search date_histogram extended_bounds

I want to get date_histogram during specific period, how to restrict the date period? Should I use the extended_bounds parameter? For example : I want to query the date_histogram between '2016-08-01' and '2016-08-31', and the interval is day. I…
zhongwei
  • 325
  • 1
  • 5
  • 15
3
votes
0 answers

Elasticsearch Date Histogram with Hour Interval

I'm trying to do this aggregation: "aggs":{ "visits_by_hour":{ "date_histogram":{ "field": "acctstarttime", "interval":"hour", "format": "HH", "min_doc_count": 0 } } } It works…
3
votes
1 answer

Plot a graph in kibana 4 with raw performance counter data

I am new to Kibana. Currently using version 4.1.0. I am using logstash agent on my application servers to publish my custom performance counters to elasticsearch incidence. The performance counter data’s are fetched from each server using logstash…
2
votes
2 answers

Histogram of time only (not accounting the date)?

I have 181 Observations at definite time points. The times are a character variable in the format "yyyy-mm-dd hh:mm:ss". I read them into a data frame via DF<-read.csv("myCSV.csv") I managed do create a histogram of the days using the date string…
Markus
  • 57
  • 1
  • 7
2
votes
1 answer

Generate date-histogram over table

I wrote a query that returns a bar graph in the terminal using Postgres CLI. The query is slow and inefficient. I would like to change that. At the base, we have a pretty simple query. We want each row to be a division of the total number of rows in…
WebWanderer
  • 10,380
  • 3
  • 32
  • 51
2
votes
1 answer

Date histogram of unique values

I am using Elasticsearch 2.3 and for each web page a user visits in my website I produce a record with user session id and current timestamp.So I have few records with same session id but different timestamp. I'm trying to create a date_histogram…
ItayD
  • 533
  • 6
  • 23
2
votes
0 answers

Using Elasticsearch Date Histogram Aggregations to Count Dates in Array Properties

I have an elasticsearch index with the following document: { dates: ["2014-01-31","2014-02-01"] } I want to count all the instances of all the days in my index separated by year and month. I hoped to do this using a date histogram aggregation…
1
vote
2 answers

Elasticsearch, date histogram omits buckets

I am trying to get a result like the kibana "discover" tab like below via date_histogram functionality my request is as below GET index-*/_search { "size": 0, "aggs": { "stats": { "date_histogram": { "min_doc_count": 0, …
thahgr
  • 718
  • 1
  • 10
  • 27
1
2 3