Update_By_Query in elasticsearch_dsl matches <field> but doesn't match <object>.<field>

I managed to do an update_by_query script with elasticsearch_dsl.

response = ubq.script(source="pm_data_source.hw_alias' = params.new_ap_name",lang="painless",params={"new_ap_name": new_ap})\
        .query("match", pm_data_source.hw_alias = old_ap ).execute()

Current problem is: in the query() I am unable to match fields inside an object. Do you happen to know how to do this?

Solved with the following:

update = ubq.script(source="ctx._source.object_name.field_name = params.new_ap_name; ctx._source.radio.Accesspoint_name = params.new_ap_name; ",
         params={ "new_ap_name": "new_field_value"  }).update_from_dict({
                    "query": {
                           "bool": {
                                  "must": [
                                         {   "match": {  "object_name.field_name": "new_field_value" } },
                                         {   "match": { "account_name": "Filters documents of specific customer" } }
response = update.execute()

The old and new field values can be provided by your python script.
hope this helps

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