Hello

I'm trying to update a document whose root object contains a list of nested
objects. I need to send an object of the nested type as a script parameter
to append to the list

How can I append the json (a string type) to the nested objects list of the
root object using Groovy? or should I use another script lang?

I tried using JsonSlurper <http://groovy-lang.org/json.html> in Groovy,
that converts between json and Groovy objects, but I always get:

Caused by:
> org.elasticsearch.script.groovy.GroovyScriptCompilationException:
> MultipleCompilationErrorsException[startup failed:
> Script3.groovy: 2: unable to resolve class JsonSlurper
>  @ line 2, column 19.
>    def jsonSlurper = new JsonSlurper();
>                      ^
> 1 error
> ]
> at
> org.elasticsearch.script.groovy.GroovyScriptEngineService.compile(GroovyScriptEngineService.java:117)
> at
> org.elasticsearch.script.ScriptService.getCompiledScript(ScriptService.java:368)
> at org.elasticsearch.script.ScriptService.compile(ScriptService.java:354)
> at
> org.elasticsearch.script.ScriptService.executable(ScriptService.java:497)
> at
> org.elasticsearch.action.update.UpdateHelper.prepare(UpdateHelper.java:149)
> ... 8 more

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CAJp2531Qm2GZbvM7CMZSd8sqjUF-VQ%3DN6YUKQam5EOPd9pBvRA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to