Set/Create field with query

Hey,

I am using the low level library in python to query all documents with a specific timestamp and want to add a new field to this documents with "script". However I cannot get it working. I just get the error:
SyntaxError: non-keyword arg after keyword arg

    enrich_scan = scan(es, index='logstash-*', doc_type='etc',
            {"script" :{"source": "ctx._source.dns_alias = dns['_source']['dns_alias']"}
             },
              query={"query" :
                   {"bool" :
                       {"must" :
                               {"match" :
                                       { "@timestamp" : dns['_source']['@timestamp'] }
                               },
                        "must" :
                               {"match" :
                                       { "asset" : dns['_source']['asset'] }
                               }
                       }
                   }
        }
)

Fixed it with the line:
"script" : { "inline" : "ctx._source.dns_alias='{!s}'".format(dns_alias)}}

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