# Elasticsearch Java API : token \['result'\] was expecting one of \[{\<EOF\>, ';'}\]

**URL:** https://discuss.elastic.co/t/elasticsearch-java-api-token-result-was-expecting-one-of-eof/229995
**Category:** Elasticsearch
**Created:** [April 27, 2020, 5:06pm UTC](https://discuss.elastic.co/t/elasticsearch-java-api-token-result-was-expecting-one-of-eof/229995 "2020-04-27T17:06:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![shamim\_Khadivinia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shamim_khadivinia/32/67214_2.png) [@shamim\_Khadivinia](https://discuss.elastic.co/u/shamim_Khadivinia)
#### Post date: [April 27, 2020, 5:06pm UTC](https://discuss.elastic.co/t/elasticsearch-java-api-token-result-was-expecting-one-of-eof/229995/1 "2020-04-27T17:06:54Z")

</div>

I wanna update one of the fields with new value In the document. The type of new value is JSON. I send a String parameter it works but when I send JSON it has an error.

```auto
           UpdateResponse response = dataTransportClient.prepareUpdate(
            index,
            type,
            docId)
                   .setScript(
                    new Script(
                            ScriptType.INLINE,
                            "painless",
                            "ctx._source.response =" + "\"" + result + "\"",
                            Collections.emptyMap()
                             )
                           )
            .setRefreshPolicy(WriteRequest.RefreshPolicy.NONE)
            .get();

```

---

<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: [May 25, 2020, 5:17pm UTC](https://discuss.elastic.co/t/elasticsearch-java-api-token-result-was-expecting-one-of-eof/229995/2 "2020-05-25T17:17:43Z")

</div>

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