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

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.

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

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