Doubt about complex query

Hello everyone

I am a beginner in kibana and I'm having trouble setting up a query to generate a metric in Kibana. But I don't know if I'm structuring it wrong or if the query isn't even possible

Giving a little context:
I have an email tracking system where I count on elasticsearch some values ​​such as: batch, userID, type, productId and a "maxItensInMail" which is the quantity of products recommended per batch / user
And my goal is to set up a query that demonstrates the adherence of clicks on the products vs the recommended amount in the email

Today this data comes in a single field in the url format:
site.com.br?lote=1234&userId=1&productId=567&type=recommendation-xpto&maxItensInMail=8

Examples:
User = 1 opening 3 products from the lot = 1234 from an email containing 8 recommendations

Records in elasticsearch:
1) site.com.br?lote=1234&userId=1&productId=567&type=recommendation-xpto&maxItensInMail=8
2) site.com.br?lote=1234&userId=1&productId=8910&type=recommendation-xpto&maxItensInMail=8
3) site.com.br?lote=1234&userId=1&productId=111213&type=recommendation-xpto&maxItensInMail=8

I can do a general query filtering by batch and algorithm but the problem I am facing now is how I get the unique hits by users (agg by batch & type) and divide it by "maxItensInMail" (which is a data that is repeated)

But my final goal is to use the return of this query to plot a bloxplot in the kibana using Vega

Does anyone have any suggestions on how I can proceed?

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