Hi
I am trying to display the difference between 2 values eg: Plan spend versus Actual spend and Percentage of spend.
- doc['PLAN-EXP'].value - doc['ACT-EXP'].value
2.(doc['PLAN-EXP'].value - doc['ACT-EXP'].value)/sum(doc['ACT-EXP'].value) - (doc['PLAN-EXP'].value - doc['ACT-EXP'].value)/NAME.value)
Scripted Field 1 works but 2 & 3 does not work.
Or i need to some how access aggregation field here
{
"query": {"match_all": {}},
"aggs": {
"NAME": {
"sum": {
"field": "ACT-EXP"
}
}
},
pls help ...thanks