How to list the array type field

I created this data by posted this in the Dev Tools > Console;

POST discuss/test
{
  "array":[0,1,2,3]
}
POST discuss/test
{
  "array":[0,3,2,9]
}

Then I created an index pattern for that data.

Discover shows this data;

I can create a Data Table visualization that shows the count of each of the values like this;

If I change the default Count metric to Sum of the array I get this. It took me a while to figure out what it was showing. For each row of the array, its showing the total sum of the arrays that contain that number. So 0 is in both arrays so it's showing the sum of both arrays. 9 is only in one array and the sum in that array is 14.

I found an interesting article here; https://www.compose.com/articles/how-to-script-painless-ly-in-elasticsearch/

That shows that you can create a scripted field that can do things with the values in an array.

So I copied some code from that doc for Painless Loops and just changed the name of the field to create this scripted field for the index;

Now in Discover we see that scripted field array_sum has the sum of the array, which you could then use in visualizations instead of trying to use the array itself;