Comparing multiple timestamp fields


(vijay karmani) #1

I've document structure like

{
username : abc
login_timestamp : 2014-04-11 11:05:00 AM
logout_timestamp : 2014-04-11 11:30:00 AM
},

{
username : def
login_timestamp : 2014-04-11 11:15:00 AM
logout_timestamp : 2014-04-11 11:45:00 AM
} ,

{
username : xyz
login_timestamp : 2014-04-11 12:10:00 PM
logout_timestamp : 2014-04-11 01:15:00 PM
}

I would like to calculate number of concurrent user sessions for a given
date. For example if login_timestamp/logout_timestamp of one user overlaps
with login_timestamp/logout_timestamp of other user then they are said to
have concurrent session and in above example, users abc and def are
having concurrent sessions. Hence output should have 2 against 2014-04-11
date.

Is it possible in es and if so then can anybody help to form a query for
this?

Thanks
Vijay

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/84a9e732-5f1b-4480-ab55-e95789813d6f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(vijay karmani) #2

anybody for any help please?

On Tuesday, November 4, 2014 10:30:09 AM UTC+5:30, vijay karmani wrote:

I've document structure like

{
username : abc
login_timestamp : 2014-04-11 11:05:00 AM
logout_timestamp : 2014-04-11 11:30:00 AM
},

{
username : def
login_timestamp : 2014-04-11 11:15:00 AM
logout_timestamp : 2014-04-11 11:45:00 AM
} ,

{
username : xyz
login_timestamp : 2014-04-11 12:10:00 PM
logout_timestamp : 2014-04-11 01:15:00 PM
}

I would like to calculate number of concurrent user sessions for a given
date. For example if login_timestamp/logout_timestamp of one user overlaps
with login_timestamp/logout_timestamp of other user then they are said to
have concurrent session and in above example, users abc and def are
having concurrent sessions. Hence output should have 2 against 2014-04-11
date.

Is it possible in es and if so then can anybody help to form a query for
this?

Thanks
Vijay

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f3f2d1d1-b051-4678-a2d4-b82832fbc877%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(vijay karmani) #3

anybody for any help please?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4946d7aa-278f-46e4-976c-f7bd9e4ba88f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(vijay karmani) #4

anybody for any help please?

On Wednesday, November 5, 2014 12:29:39 PM UTC+5:30, vijay karmani wrote:

anybody for any help please?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1c38cafc-6f72-4ad4-a189-4e5050187da4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(vineeth mohan-2) #5

Helli Vijay ,

I cant think of any straight and efficient way to implement this.
But then you can write your own map reduce script ( Feature in 1.4.0) to
gather this information -
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-metrics-scripted-metric-aggregation.html

Thanks
Vineeth

On Tue, Nov 4, 2014 at 10:30 AM, vijay karmani vijay.karmani@gmail.com
wrote:

I've document structure like

{
username : abc
login_timestamp : 2014-04-11 11:05:00 AM
logout_timestamp : 2014-04-11 11:30:00 AM
},

{
username : def
login_timestamp : 2014-04-11 11:15:00 AM
logout_timestamp : 2014-04-11 11:45:00 AM
} ,

{
username : xyz
login_timestamp : 2014-04-11 12:10:00 PM
logout_timestamp : 2014-04-11 01:15:00 PM
}

I would like to calculate number of concurrent user sessions for a given
date. For example if login_timestamp/logout_timestamp of one user overlaps
with login_timestamp/logout_timestamp of other user then they are said to
have concurrent session and in above example, users abc and def are
having concurrent sessions. Hence output should have 2 against 2014-04-11
date.

Is it possible in es and if so then can anybody help to form a query for
this?

Thanks
Vijay

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/84a9e732-5f1b-4480-ab55-e95789813d6f%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/84a9e732-5f1b-4480-ab55-e95789813d6f%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5mNDbU_C7Qo00TYW5qNg7qdepnJbKprp9eWTX_pNu%3DS_g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(vijay karmani) #6

Thanks Vineeth for your answer. I will give it a shot.

On Thursday, November 6, 2014 3:24:28 PM UTC+5:30, vineeth mohan wrote:

Helli Vijay ,

I cant think of any straight and efficient way to implement this.
But then you can write your own map reduce script ( Feature in 1.4.0) to
gather this information -
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-metrics-scripted-metric-aggregation.html

Thanks
Vineeth

On Tue, Nov 4, 2014 at 10:30 AM, vijay karmani <vijay....@gmail.com
<javascript:>> wrote:

I've document structure like

{
username : abc
login_timestamp : 2014-04-11 11:05:00 AM
logout_timestamp : 2014-04-11 11:30:00 AM
},

{
username : def
login_timestamp : 2014-04-11 11:15:00 AM
logout_timestamp : 2014-04-11 11:45:00 AM
} ,

{
username : xyz
login_timestamp : 2014-04-11 12:10:00 PM
logout_timestamp : 2014-04-11 01:15:00 PM
}

I would like to calculate number of concurrent user sessions for a given
date. For example if login_timestamp/logout_timestamp of one user overlaps
with login_timestamp/logout_timestamp of other user then they are said to
have concurrent session and in above example, users abc and def are
having concurrent sessions. Hence output should have 2 against 2014-04-11
date.

Is it possible in es and if so then can anybody help to form a query for
this?

Thanks
Vijay

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/84a9e732-5f1b-4480-ab55-e95789813d6f%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/84a9e732-5f1b-4480-ab55-e95789813d6f%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4d2bad52-85cc-4f33-a67b-81235d42bf4e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


#7

I've the same need and I havn't found how map reduce script can help. Have you found a solution ?
Thanks.


(system) #8