Script to subtract values between 2 elastic search _types

I have an elastic search index that has 2 sets of data (and I have templates a variable based on _ type)

Here is the sample doc

_index:bu_compute_summary
_type:letsdoit_compute_summary
_id:xxxx
_source:{

cpu_count:100

}

_index:bu_compute_summary
_type:total_compute_summary
_id:xxxx
_source:{

cpu_count:900

}

I want to write a query to subtract cpu count on _type:total_compute_summary (900) and cpu count on _type:letsdoit_compute_summary (100)! Is this possible? I want to basically plot a pie chart with values of cpu_count of letsdoit_compute_summary vs cpu_count_compute_summary of total__compute_summary minus letsdoit__compute_summary (or a D3 GAUGE is even merrier)

@torkel @daniellee :slightly_smiling_face: any help ?

Does this help?

EDIT: nevermind, it was you who asked that question before. Sorry, I don’t know.

The question was little different there @daniellee …its arithmetic in the same document index …here it is about 2 elastic search documents

Yeah, saw that afterwards. Sorry, I don’t know if that is possible.