I have aמ index with documents that contain several fields, among these are:
grade
person_id
I wish to create an aggregation that count the number of documents found for each person_id and for each person sum or average the grade of the documents associated with it.
so you need an aggregation within an aggregation. It seems to me, that you first want to group by person_id, which means, you need a terms aggregation on that field. Within that aggregation you need an avg or sum aggregation on the grade field - and that should be it.
Would that work as a start or am I missing something in the requirements?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.