# Update\_by\_query updating only one field

**URL:** <https://discuss.elastic.co/t/update-by-query-updating-only-one-field/138067>\
**Category:** Elasticsearch\
**Created:** [June 30, 2018, 9:01pm UTC](https://discuss.elastic.co/t/update-by-query-updating-only-one-field/138067 "2018-06-30T21:01:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shrike718](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@shrike718](https://discuss.elastic.co/u/shrike718)\
**Post date:** [June 30, 2018, 9:01pm UTC](https://discuss.elastic.co/t/update-by-query-updating-only-one-field/138067/1 "2018-06-30T21:01:58Z")

</div>

I have an index called "shipments" and it has a STA\_CD. I would like to perform an update using CURL to update all documents with STA\_CD = "OH" to STA\_CD="FL". I'm having a lot of problems with the syntax.  
Here's what I'm starting with but I'm not getting any matches:

curl -X POST "localhost:9200/shipments/\_update\_by\_query" -H 'Content-Type: application/json' -d'  
{  
"query":{  
"term":{  
"STO\_STA\_CD":"OH"  
}  
},  
"script":"ctx.\_source.STO\_STA\_CD = 'AK'"  
}  
'

---

<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 28, 2018, 9:01pm UTC](https://discuss.elastic.co/t/update-by-query-updating-only-one-field/138067/2 "2018-07-28T21:01:59Z")

</div>

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