Update by query on nested mapping

So, I've successfully created a field and added a value for it in existing documents using the put mapping and update by query APIs with the following

    NEW_FIELD = {
        'properties': {
            'deleted': {
                'type': 'boolean'
            }
        }
    }

    UPDATE_QUERY = {
        'script': {
            'source': 'ctx._source.deleted = false',
            'lang': 'painless'
        },
        'query': {
            'match_all': {}
        }
    }

Now, the same won't work for a field that is inside an existing array, I was able to create the field but the update query doesn’t seem to be correct:

    NEW_FIELD = {
        'properties': {
            'customer': {
                'properties': {
                    'sensitive': {
                        'type': 'boolean'
                    }
                }
            }
        }
    }

    UPDATE_QUERY = {
        'script': {
            'source': 'ctx._source.customer.sensitive = false',
            'lang': 'painless'
        },
        'query': {
            'match_all': {}
        }
    }

If it's an array, you will have to specify index to locate specific entry to modify. To modify all entries you will need loop.

Like this? 'ctx._source.customer['sensitive'] = false'

No. Something like

ctx._source.customer[0].sensitive = false