I'm working in Kibana. I have an index with each document representing a sold product with product_quantity, order_id, customer_id, order_date and returned_quantity. I want to calculate a few things:
-
Average number of orders per customer. Which means I have to calculate unique count of order_id / unique count of customer_id.
-
Return rate. Which means I have to calculate sum of returned_quantity / sum of product_quantity to divide the number of all returned products by the number of all sold products.
In both cases I am only able to display the single metrics I need (like sum/ unique count) but I am not able to divide them by one another. I read that scripted fields could help but I don't think they can solve those cases plus I do not know how to write those scripts since I have no programming knowledge. Is there any way to do this?