How to loop the hit result and compare the value for each from query result?

Hi ,

I'm new to DSL query, I have a use case like 'find the id that DPS > 100 and it does increasing in 2018 <> compare to 2017.

[DATA]
ID DPS DATE
5 100 2017
5 110 2018
1 50 2018
1 60 2017

I try to use below query to get the 2017 result, but I have no idea how to compare and loop via the hit result that return from query. Any instruction / sample can help , please ? Thanks a lot

GET testing/_search
{
   "query":{
     "bool":{
      "filter":{
        "range": {
           "date" : {          
               "gte" : "now-1y/y",
               "lt" :  "now/y"
           }
        }
       },
     "must" : {
       "range" : {
         "dps" : { "gte" : 100 }
       }
      },
      "boost" : 1.0
     }
  }
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.