Thank you Adrien Grand for reply.
Is it possible to use aggregate functions inside script??

On Wednesday, May 7, 2014 5:31:20 PM UTC+5:30, Adrien Grand wrote:
>
> Hi,
>
> There is no way to do it on the Elasticsearch side for the moment. It can 
> only be done on client side.
>
>
> On Wed, May 7, 2014 at 1:37 PM, Alex Mathew 
> <alexmathe...@gmail.com<javascript:>
> > wrote:
>
>> How to write an ES query to find the difference between max and min value 
>> of a field?
>>
>> I am a newbee in elastic search, In my case I feed lot of events along 
>> with session_id and time in to elastic search. My event structure is
>>
>> Event_name string    
>> Client_id  string    
>> App_id     string    
>> Session_id string    
>> User_id    string    
>> Ip_address string    
>> Latitude   int64     
>> Longitude  int64     
>> Event_time time.Time 
>>
>>
>> I want to find the life time of a session_id based the feeded events. For 
>> that I can retrive the maximum Event_time and minimum Event_time for a 
>> particular session_id by the following ES query.
>>
>> {  
>>   "size": 0,
>>   "query": {
>>      "match": {
>>         "Session_id": "dummySessionId"
>>      }
>>   },
>>    "aggs": {
>>       "max_time": {
>>          "max": {
>>            "field": "Time"
>>           }
>>        },
>>        "min_time":{
>>           "min": {
>>             "field": "Time"
>>           }
>>        }
>>     }
>>   }
>>
>>
>> But what I exact want is (max_time - min_time) How to write the ES query for 
>> the same????
>>
>>  -- 
>> 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/1e937884-4052-4a5a-91db-bc1449c43efe%40googlegroups.com<https://groups.google.com/d/msgid/elasticsearch/1e937884-4052-4a5a-91db-bc1449c43efe%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Adrien Grand
>  

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/ab72a9e2-60d4-4865-9c71-351b79322f29%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to