Is there any better way in elasticsearch (other than issuing a match all query and manually averaging over the length of all returned documents) to get the average document
Shot in the dark, but facets or aggregations combined with a script might do it.
{ ..., "aggs" : { "avg_length" : { "avg" : { "script" : "doc['_all'].length" } } } }