How to calculate between document


(Tiantian Gao) #1

Hi experts,

A quick question: I have two type of document, the one means 'start' of
event, the other means the 'end' of event.
The two item of the event pair has the same 'req_id'.

The two type of document looks like below. The same 'req_id', one type is
'start', the other is 'end':
{"id": "1", "req_id": "x", "type": "start", "timestamp": "11111"}
{"id": "2", "req_id": "x", "type": "end", "timestamp": "11122"}

I want to do statistic of the interval of the event pair, in this case the
interval is 11122 - 11111 = 11.
I have look through ElasticSearch DSL, but find nothing helpful. Maybe I
can write client code to do the statistic,
but I believe ElasticSearch support this kind of action.

Please let me know if I can provide more explanation. And thank you very
mush for any suggestion.

Best regards,
gtt

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(David Pilato) #2

My guess is that you should index begin and end within the same doc, aka update doc with Id 1.

HTH

David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 22 sept. 2013 à 14:36, Tiantian Gao gtt116@gmail.com a écrit :

Hi experts,

A quick question: I have two type of document, the one means 'start' of event, the other means the 'end' of event.
The two item of the event pair has the same 'req_id'.

The two type of document looks like below. The same 'req_id', one type is 'start', the other is 'end':
{"id": "1", "req_id": "x", "type": "start", "timestamp": "11111"}
{"id": "2", "req_id": "x", "type": "end", "timestamp": "11122"}

I want to do statistic of the interval of the event pair, in this case the interval is 11122 - 11111 = 11.
I have look through ElasticSearch DSL, but find nothing helpful. Maybe I can write client code to do the statistic,
but I believe ElasticSearch support this kind of action.

Please let me know if I can provide more explanation. And thank you very mush for any suggestion.

Best regards,
gtt

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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Tiantian Gao) #3

Thanks David,

So I'm afraid I need write some code to update the index by myself.

cheers,
gtt
在 2013-9-22,下午11:03,David Pilato david@pilato.fr 写道:

My guess is that you should index begin and end within the same doc, aka update doc with Id 1.

HTH

David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 22 sept. 2013 à 14:36, Tiantian Gao gtt116@gmail.com a écrit :

Hi experts,

A quick question: I have two type of document, the one means 'start' of event, the other means the 'end' of event.
The two item of the event pair has the same 'req_id'.

The two type of document looks like below. The same 'req_id', one type is 'start', the other is 'end':
{"id": "1", "req_id": "x", "type": "start", "timestamp": "11111"}
{"id": "2", "req_id": "x", "type": "end", "timestamp": "11122"}

I want to do statistic of the interval of the event pair, in this case the interval is 11122 - 11111 = 11.
I have look through ElasticSearch DSL, but find nothing helpful. Maybe I can write client code to do the statistic,
but I believe ElasticSearch support this kind of action.

Please let me know if I can provide more explanation. And thank you very mush for any suggestion.

Best regards,
gtt

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elasticsearch/XS_bOE_6jjk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4