Function in defining mapping

Think about this requirement:
Say I've parent-child relationship as follows:
Customer->Orders
A customer can have multiple order.

I want to maintain Customer.MaxOrderTotal this field will maintain maximum price for his/her orders.
E.g. If a customer has 3 orders of OrderTotal: $10, $15, $2 then Customer.MaxOrderTotal should hold value as $15.

I don't want to update this value each time order is indexed. Also I don't want to use aggregations in search.

Is there anyway where while defining elastic index mapping, I can configure this field should hold MAX value of order total?

Something like following:
mappings": {
"_doc": {
"properties": {
"MaxOrderTotal": {
"type": "A FUNCTION INDICATING MAX OF OTHER FIELD"
}

I am using elastic6.3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.