How to grab a count of document fields and creating a percentage of fields filled in

Hey all,

I'm trying to find a way to see which documents are the most populated in an index. I have a dataset that is sparsely populated, some fields have empty strings or null values. I would like to create a "percentage filled" for each document and store it in a field at the end of the document. So if a document has 10 fields and only 5 were not null or empty, that document would be 50% filled and then if possible, I'd like to store that percentage in an 11th field.

Is there any metadata functionality like this built into elasticsearch?

I was looking at using the _size field but that is only at the source level, not the document level. Thanks in advance for any input.