If seems like the UpdateRequestBuilder won't accept DateTime (or Date)
instances as script params (see stacktrace below). DateTime works fine
for the index api. A workaround is to manually (toString) convert the
DateTime instance to a String.
Is this a bug or is it the intended behaivor?
/Per.
...
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("mydate", DateTime.now());
updateRequestBuilder.setScriptParams(map);
..
Caused by: java.io.IOException: Can't write type [class
org.joda.time.DateTime]
at
org.elasticsearch.common.io.stream.StreamOutput.writeGenericValue(StreamOutput.java:
266)
at
org.elasticsearch.common.io.stream.StreamOutput.writeGenericValue(StreamOutput.java:
260)
at
org.elasticsearch.common.io.stream.StreamOutput.writeMap(StreamOutput.java:
205)
at
org.elasticsearch.action.update.UpdateRequest.writeTo(UpdateRequest.java:
358)
at
org.elasticsearch.transport.support.TransportStreams.buildRequest(TransportStreams.java:
117)
at
org.elasticsearch.transport.netty.NettyTransport.sendRequest(NettyTransport.java:
452)
at
org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:
185)
at
org.elasticsearch.action.support.single.instance.TransportInstanceSingleOperationAction
$AsyncSingleAction.start(TransportInstanceSingleOperationAction.java:
191)
at
org.elasticsearch.action.support.single.instance.TransportInstanceSingleOperationAction
$AsyncSingleAction.start(TransportInstanceSingleOperationAction.java:
119)
at
org.elasticsearch.action.support.single.instance.TransportInstanceSingleOperationAction.doExecute(TransportInstanceSingleOperationAction.java:
71)
at
org.elasticsearch.action.support.single.instance.TransportInstanceSingleOperationAction.doExecute(TransportInstanceSingleOperationAction.java:
49)
at
org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:
61)
at org.elasticsearch.client.node.NodeClient.execute(NodeClient.java:
83)
at
org.elasticsearch.client.support.AbstractClient.update(AbstractClient.java:
101)
at
org.elasticsearch.action.update.UpdateRequestBuilder.doExecute(UpdateRequestBuilder.java:
177)