Count sessions from events

Hello,

I'm rather novice in Kibana/Elasticsearch.

I have records of sessions containing two fields:

"mappings": {
....
"start_date": {
"type": "date",
"format": "dateOptionalTime"
},
"end_date": {
"type": "date",
"format": "dateOptionalTime"
},
....
}

My purpose is to plot the number of active sessions in function of the time, that is for a given time t, the number of documents with start_date <= t <= end_date.

How can I do this ? I did not find any simple way, either using date histograms or other aggregations to do this.

Alternatively, is there a way to plot in Kibana the difference of two curves (a kind of stacked date histograms with one serving as a reference, i;e. one being set to 0).

Thank you for any hint,

Fred

Hi. You might have to preprocess your data to get this working at the moment.
See this post by Mark Harwood for some ideas on how you could do this. https://www.elastic.co/elasticon/2015/sf/building-entity-centric-indexes

Check out this issue on github for some hints on what the plans are for aggregations.

Hi Christoffer,

thank you very much for your answer and for the link.

Actually, hacking the query in the date histogram panel could be an alternative to what i'm looking for ...

Fred