I would like to come up with a scripted field of sum of all values based on document keys. So for example I have the following k=v pairs.
doc['totalA'] = 1
doc['totalB'] = 3
doc['totalC'] = 3
I would like to sum all the values if the key matches total*. How do I go about this? I can obviously explicitly mention each document name, I just would like to match a pattern and sum it all if possible?