I'm using elasticsearch 0.90.10 and I want to perform a search on it using a query with aggregation functions like sum()
, avg()
, min()
.
Suppose my data is something like that
[
{
"name" : "Alice",
"grades" : [40, 50, 60, 70]
},
{
"name" : "Bob",
"grades" : [10, 20, 30, 40]
},
{
"name" : "Charlie",
"grades" : [70, 80, 90, 100]
}
]
Let's say I need to fetch students with average grade greater than 75 (i.e. avg(grades) >= 75
). How can I wrote such a query in ES using DSL, filters or scripting?
Thanks in advance.