Hi guys,
I've a sample dataset with 3 columns (ID, ACTION and AMOUNT):
I would like to create a DSL query in order to check minute by minute:
- number of documents with ACTION = "purchase" (paramA)
- number of documents with ACTION = "refund" (paramB)
- calculate incidence of purchases minute by minute as: paramA / total number of documents (in same minute)
- calculate incidence of refunds minute by minute as: paramB / total number of documents (in same minute)
I found documentation about "bucket_script", but I'm not able to count Items, not sum them.
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-bucket-script-aggregation.html
My expectation is:
minute 11:30:
- Number of documents: 6
- Number of purchases: 3
- Number of refunds: 3
- Incidence of purchases: 3 / 6 * 100
- Incidence of refunds: 3 / 6 * 100
Could you help me, please?