# \_update\_by\_query - Update with match criteria in other index

**URL:** <https://discuss.elastic.co/t/update-by-query-update-with-match-criteria-in-other-index/135450>\
**Category:** Elasticsearch\
**Created:** [June 12, 2018, 2:50am UTC](https://discuss.elastic.co/t/update-by-query-update-with-match-criteria-in-other-index/135450 "2018-06-12T02:50:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lyteh](https://avatars.discourse-cdn.com/v4/letter/l/b5a626/32.png) [@lyteh](https://discuss.elastic.co/u/lyteh)\
**Post date:** [June 12, 2018, 2:50am UTC](https://discuss.elastic.co/t/update-by-query-update-with-match-criteria-in-other-index/135450/1 "2018-06-12T02:50:22Z")

</div>

I trying to loop thrus a single index (eg: userprofiles) and update the single field (eg: user\_type) if the userprofiles.NAME is exist in other index (eg: badlistedusers)

Can "\_update\_by\_query" API do that?

**userprofiles mapping**

"mappings" : {  
"doc": {  
"properties" : {  
"NAME" : { "type" : "text" },  
"USER\_TYPE" : { "type" : "text" }  
}  
}  
}

**badlistedusers mapping**

"mappings" : {  
"doc": {  
"properties" : {  
"NAME" : { "type" : "text" }  
}  
}  
}

---

<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:** [July 10, 2018, 2:52am UTC](https://discuss.elastic.co/t/update-by-query-update-with-match-criteria-in-other-index/135450/2 "2018-07-10T02:52:59Z")

</div>

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