Condition in JSON Input Script/aggs

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:

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

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

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