How to generate dynamic term or field in kibana

I need dynamically generated field. Suppose I have Subject1 and Subject2 terms or fields and values are 40 and 50 respectively. In data table I need percentage term dynamically based on these two fields. I am taking only one field for aggregation i.e. Subject1 then percentage term should display percentage of Subject1 only. And if we are taking both fields Subject1 and Subject2 then percentage field should display percentage of both fields.

I have created scripted field like this ((doc['Math'].value+doc['English'].value)/200)*100 and field name is percentage. But its not dynamic. Based on selected fields in aggregation percentage should display.
Please provide solution.

Hi @ajit,

unfortunately, scripted fields can only access the document itself. An alternative would be to create multiple scripted field and select the correct one depending on the visualization.

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