# Update by query not work on linux terminal but work on devtool UI

**URL:** https://discuss.elastic.co/t/update-by-query-not-work-on-linux-terminal-but-work-on-devtool-ui/313517
**Category:** Elasticsearch
**Tags:** elastic-stack-monitoring, painless
**Created:** [September 2, 2022, 7:59am UTC](https://discuss.elastic.co/t/update-by-query-not-work-on-linux-terminal-but-work-on-devtool-ui/313517 "2022-09-02T07:59:30Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![siwapong.cha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/siwapong.cha/32/110333_2.png) [@siwapong.cha](https://discuss.elastic.co/u/siwapong.cha)
#### Post date: [September 2, 2022, 7:59am UTC](https://discuss.elastic.co/t/update-by-query-not-work-on-linux-terminal-but-work-on-devtool-ui/313517/1 "2022-09-02T07:59:30Z")

</div>

I'm doing the update by query and it's work well on the devtool UI  
Screenshot below

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/d/ed75e931b5f9d2882e9e3375f48f27908f19d0c0.png)

But when I did the same thing on linux terminal

```auto
curl -X POST -k -u myusername:mypassword "https://localhost:9200/my-index/_update_by_query" -H 'Content-Type: application/json' -d'
{
  "script": {
    "inline": "ctx._source.field4 = 'New Value'",
    "lang": "painless"
  },
  "query": {
      "bool": {
            "must": [
                {"match": {"field1": "1"}},
                {"match": {"field2": "2"}},
                {"match": {"field3": "3"}}
            ]
      }
    }
}
' 

```

I got this error, looks like a single quote error on the inline attribute? how to fix this one on linux terminal

```auto
{
  "error": {
    "root_cause": [
      {
        "type": "script_exception",
        "reason": "compile error",
        "script_stack": [
          "... _source.field4 = New Value",
          " ^---- HERE"
        ],
        "script": "ctx._source.field4 = New Value",
        "lang": "painless",
        "position": {
          "offset": 29,
          "start": 4,
          "end": 39
        }
      }
    ],
    "type": "script_exception",
    "reason": "compile error",
    "script_stack": [
      "... _source.field4 = New Value",
      " ^---- HERE"
    ],
    "script": "ctx._source.field4 = New Value",
    "lang": "painless",
    "position": {
      "offset": 29,
      "start": 4,
      "end": 39
    },
    "caused_by": {
      "type": "illegal_argument_exception",
      "reason": "cannot resolve symbol [New Value]"
    }
  },
  "status": 400

```

---

<div class="post-metadata">

### Author: ![siwapong.cha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/siwapong.cha/32/110333_2.png) [@siwapong.cha](https://discuss.elastic.co/u/siwapong.cha)
#### Post date: [September 2, 2022, 8:21am UTC](https://discuss.elastic.co/t/update-by-query-not-work-on-linux-terminal-but-work-on-devtool-ui/313517/2 "2022-09-02T08:21:48Z")

</div>

After stuck at this for a whole day, finally got it solved by self

This is the fixed  
Fail one ------ "inline": "ctx.\_source.field4 = 'New Value'",  
Fixed one ------ "inline": "ctx.\_source.field4 = \"New Value\"",

---

<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: [September 30, 2022, 8:21am UTC](https://discuss.elastic.co/t/update-by-query-not-work-on-linux-terminal-but-work-on-devtool-ui/313517/3 "2022-09-30T08:21:59Z")

</div>

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