I am creating percentage as scripted field in kibana with hard coded columns or field values. But I need only those columns or fields which are selected in visualisation. So that I will get percentage on only selected fields. For this requirement I need dynamically values from only selected columns in visualisation.
This is my script ((doc['Math'].value+doc['English'].value)/200)*100
But if I select only Math column in visualisation then I should get percentage only for Math.
Meaning that I need only selected column values in visualisation in script dynamically.
Please provide solution.