# Multi \_update\_by\_query API like MultiSearch \_msearch - how to? possible?

**URL:** <https://discuss.elastic.co/t/multi-update-by-query-api-like-multisearch-msearch-how-to-possible/261673>\
**Category:** Elasticsearch\
**Created:** [January 20, 2021, 3:48pm UTC](https://discuss.elastic.co/t/multi-update-by-query-api-like-multisearch-msearch-how-to-possible/261673 "2021-01-20T15:48:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Datakids](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/datakids/32/39622_2.png) [@Datakids](https://discuss.elastic.co/u/Datakids)\
**Post date:** [January 20, 2021, 3:48pm UTC](https://discuss.elastic.co/t/multi-update-by-query-api-like-multisearch-msearch-how-to-possible/261673/1 "2021-01-20T15:48:59Z")

</div>

Hi all,

I have following question regarding the multiple search api \_msearch

Is there a way to do the same by using the \_update\_by\_query api ?

UseCase: change entries of fields based on mutliple bool query like:

```
POST /myindex/_update_by_query
{
  "query" : {
    "bool" : {
      "filter" : {
        "terms" : {
          "Nr.keyword" : "12345"
        }
      }
    }
  },
    "script" : {
      "source" : "ctx._source.Wordcloud.keyword= 'Hallo'", 
      "lang" : "painless"
      }
},
{
  "query" : {
    "bool" : {
      "filter" : {
        "terms" : {
          "Nr.keyword" : "67890"
        }
      }
    }
  },
    "script" : {
      "source" : "ctx._source.Wordcloud.keyword= 'Welt'", 
      "lang" : "painless"
      }
},
{
  "query" : {
    "bool" : {
      "filter" : {
        "terms" : {
          "Nr.keyword" : "101112"
        }
      }
    }
  },
    "script" : {
      "source" : "ctx._source.Wordcloud.keyword= '!'", 
      "lang" : "painless"
      }
} 

```

Thanks in advance for your suggestions

Regards

---

<div class="post-metadata">

**Author:** ![rohit\_pandey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rohit_pandey/32/82910_2.png) [@rohit\_pandey](https://discuss.elastic.co/u/rohit_pandey)\
**Post date:** [February 8, 2021, 7:05am UTC](https://discuss.elastic.co/t/multi-update-by-query-api-like-multisearch-msearch-how-to-possible/261673/2 "2021-02-08T07:05:36Z")

</div>

Hi @Datakids, are you able to find any solution for this problem.  
Trying to achieve the same thing.

---

<div class="post-metadata">

**Author:** ![Datakids](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/datakids/32/39622_2.png) [@Datakids](https://discuss.elastic.co/u/Datakids)\
**Post date:** [February 28, 2021, 4:28pm UTC](https://discuss.elastic.co/t/multi-update-by-query-api-like-multisearch-msearch-how-to-possible/261673/3 "2021-02-28T16:28:49Z")

</div>

Hi,  
no sorry, nothing you could use native inside ES  
I go with python...  
regards

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [February 28, 2021, 11:15pm UTC](https://discuss.elastic.co/t/multi-update-by-query-api-like-multisearch-msearch-how-to-possible/261673/4 "2021-02-28T23:15:28Z")

</div>

There isn't a multi version. Update by query is already fairly expensive so it wouldn't usually be worth it, I think. If you can get by with a regular `update` operation then you can use the `bulk` api.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 28, 2021, 11:15pm UTC](https://discuss.elastic.co/t/multi-update-by-query-api-like-multisearch-msearch-how-to-possible/261673/5 "2021-03-28T23:15:28Z")

</div>

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