Elastic search and nested fields

I have an existing elastic search table with nested fields, here’s the partial mapping code:




"properties": {

   ....

  "location": {

     "properties": {

          "address": {

             "type": "string"

           },

           "lat": {

              "type": "double"

            },

            "lng": {

              "type": "double"

            },

           ......

            }

          },

 ... rest of mapping

},

If I try to access any of the location properties I can do it by:




$es = Es::find()->one();

echo $es->location['address'];



However if I want to update address:




$es->location['address'] = 'New address';



I get the following error:

Indirect modification of overloaded property …\models\Es::$location has no effect

What should be the correct way to update this field?

bump