Arithmetic operation in kibana

Hi

I have an index where i am storing a number of items per category every day. I store one document for each category, for example:
{date:22/07/2019, :status: TOTAL, count: 1000}
{date:22/07/2019, :status: SOLD, count: 400}
{date:21/07/2019, :status: TOTAL, count: 800}
{date:21/07/2019, :status: SOLD, count: 300}

I want to display a line graph that calculates for each day the difference between TOTAL and SOLD. It is, for 21/07/2019, it will display 500, and for 22/07/2019 it will display 600

Initially i wanted to create a scripted field, but, since they are different documents, i realised i could not do that.

Any idea on how can i create this with Kibana?

Thanks

Hello,

Do you have strong reasons for creating a document for each category? You can use either timelion or time series visual builder for doing this.

https://www.elastic.co/guide/en/kibana/current/timelion.html

Thanks,
Bhavya

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