Script plugin parameters throw IOException: can not write type

(Hector R ) #1

Hi all,

we are upgrading elastic search from 2.3.3 to 5.4.0 and facing a problem. We have a plugin with a native script registered. The script field is added like this to the search request:

ImmutableMap<String, Object> params = ImmutableMap.<String, Object>of(
                "command", command,
                "session", new XContentSession(EvaluatorSessionElement.buildSession(binding, getSelections(), elementConstraintMap, false))
requestBuilder.addScriptField("result", new Script(ScriptType.INLINE, "native", "tql-evaluator", params));

XContentSession is a class that implements ToXContent.

In 2.3.3, although the second parameter was a XContentSession, it was passed to the script as a Map and there we converted it to XContentSession. Upgrading to 5.4.0, it seems the parameter is passed as a XContentSession, which seems good and better, but then when executing the search request we got an exception like:

! can not write type [class]
! at
! at$static$11(
! at
! at
! at org.elasticsearch.script.Script.writeTo(
! at$ScriptField.writeTo(
! at
! at
! at
! at
! at org.elasticsearch.transport.TcpTransport.buildMessage(
! at org.elasticsearch.transport.TcpTransport.sendRequestToChannel(
! at org.elasticsearch.transport.TcpTransport.access$1100(
! at org.elasticsearch.transport.TcpTransport$NodeChannels.sendRequest(
! at org.elasticsearch.transport.TransportService.sendRequestInternal(
! at org.elasticsearch.transport.TransportService.sendRequest(
! at org.elasticsearch.transport.TransportService.sendRequest(
! at org.elasticsearch.action.TransportActionNodeProxy.execute(
! at org.elasticsearch.client.transport.TransportProxyClient.lambda$execute$0(
! at org.elasticsearch.client.transport.TransportClientNodesService.execute(
! at org.elasticsearch.client.transport.TransportProxyClient.execute(
! at org.elasticsearch.client.transport.TransportClient.doExecute(
! at
! at org.elasticsearch.action.ActionRequestBuilder.execute(
! at org.elasticsearch.action.ActionRequestBuilder.execute(
! ... 14 common frames omitted

Any ideas of what we are missing? Is this change in behaviour between versions intended? Do we need to convert the param to a Map (and all submaps) or elastic search offers something? Parameters have to be objects so should be supported I guess.


(system) #2

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