I have an index with this kind of document:
{
"_id": "6827",
"_index": "test",
"_score": 1.0,
"_source": {
"class": [
{
"name": "physics",
"grade" : [
12,
2
],
},
{
"name": "french",
"grade" : [
4,
8,
],
},
{
"name": "sport",
"grade": [
14,
18,
16
]
}
]
},
"_type": "student"
}
A student may have different number of subscribed class
I would like to:
- know how is distributed the number of class (number of student with 1 class, with 2 classes and so on)
- how many times each class is taken (I know all the possible classes)
I've seen that metric aggregations are possible, and that what I want to do is possible. But I am a newbie with es and I did not succeed to make things up with this.
May anyone help ?