Condition in JSON Input Script/aggs


#1

Hey guys,

is it possible to make some conditions in the JSON Input/Aggregations.
For example:

"aggs": {
     "calculation": {
          "sum": {          
                   "script": if (doc['Field1'].value - doc['Field2'].value > 0) { ... }
           }
        }
    }

Thanks in advance.. :slight_smile:


(Matt Bargar) #2

I may be misunderstanding what you're trying to do, but it looks like what you need is a scripted field


#3

Yeah, thanks Matt. That's exactly what I searched for :confetti_ball:


(system) #4

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