Is there a way to use update by query in template?

I want to create a template which will take user's value and will search against those values and update those returned documents which matched the user given condition. plz see the following

POST _scripts/<template name>
    "script": {
        "lang": "mustache",
        "source": {
        "multi_match" :{
          "query": "{{Sender/cc/bcc/to}}",
          "fields": ["from","to","cc","bcc"]
   }       }
  "script" : "ctx._source.lebel_id = {{label_id}}; ctx.source.case_id={{case_id }}"
GET /_search/template
    "id":"<template name>", 
    "params": {
        "Sender/cc/bcc/to": "",
        "case_id": 10,
       "labe_id": 12

Is it possible to do it in one query?

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