How to subtract between two fields?

New to this but tried to follow the Elastic docs and it didn't work for me. Trying to create a Visualizer where I want to subtract field1 from field2 using the Advanced JSON scripting. Keeps saying I have an error but not sure what the error is. Tried also with 'Filters' aggregation and got same result. I must be missing something very simple so please guide me; please see attached screenshots. Thanks.

image

You will probably want to create a scripted field instead https://www.elastic.co/guide/en/kibana/5.6/scripted-fields.html

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