I would like to take an average of lengths using the json input for a document.
Let's say the documents are structured as follows
{
"@timestamp" : "<TIMESTAMP>",
"items" : [
{ "a" : 1 },
{ "b" : 2 },
{ "c" : 13 }
]
}
Then i would like to make a visualisation to take the average length of all the items
.
How would I set the aggregation and Json input?
I believe the Json Input would be:
{"script" : "doc['items'].value.length()" }
But when I choose average I have to choose a field, which I am trying to supply with the Json Input, i.e. the length of the items
list to be averaged.