Hey,
With the documents:
documentA: { "code": ["foo", "bar"] }
documentB: { "code": ["foo", "foo"] }
documentC: { "code": ["bar", "quux"] }
documentD: { "code": ["quux", "bar"] }
I would like to get the following statistics:
count_total: 8
count_foo: 3
count_bar: 3
percentage_foo: 37,5%
percentage_bar: 37,5%
The use case is that we want to get an alert if a percentage of a specific value is above a certain number. And possibly a dashboard with the percentage over time, using the @timestamp field.