# Java update API doesn't support serialization of Collection

**URL:** <https://discuss.elastic.co/t/java-update-api-doesnt-support-serialization-of-collection/13789>\
**Category:** Elasticsearch\
**Created:** [September 27, 2013, 3:56pm UTC](https://discuss.elastic.co/t/java-update-api-doesnt-support-serialization-of-collection/13789 "2013-09-27T15:56:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Bellora](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul_bellora/32/74372_2.png) [@Paul\_Bellora](https://discuss.elastic.co/u/Paul_Bellora)\
**Post date:** [September 27, 2013, 3:56pm UTC](https://discuss.elastic.co/t/java-update-api-doesnt-support-serialization-of-collection/13789/1 "2013-09-27T15:56:04Z")

</div>

I tried to provide a HashSet as a parameter to an update script and  
got this exception:

java.io.IOException: Can't write type [class java.util.HashSet]  
at  
org.elasticsearch.common.io.stream.StreamOutput.writeGenericValue(StreamOutput.java:390)  
at  
org.elasticsearch.common.io.stream.StreamOutput.writeGenericValue(StreamOutput.java:369)  
at  
org.elasticsearch.common.io.stream.StreamOutput.writeMap(StreamOutput.java:314)  
at  
org.elasticsearch.action.update.UpdateRequest.writeTo(UpdateRequest.java:604)  
at  
org.elasticsearch.transport.netty.NettyTransport.sendRequest(NettyTransport.java:545)  
at  
org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:188)  
at  
org.elasticsearch.action.support.single.instance.TransportInstanceSingleOperationAction$AsyncSingleAction.start(TransportInstanceSingleOperationAction.java:203)  
at  
org.elasticsearch.action.support.single.instance.TransportInstanceSingleOperationAction$AsyncSingleAction.start(TransportInstanceSingleOperationAction.java:128)  
at  
org.elasticsearch.action.support.single.instance.TransportInstanceSingleOperationAction.doExecute(TransportInstanceSingleOperationAction.java:71)  
at  
org.elasticsearch.action.update.TransportUpdateAction.innerExecute(TransportUpdateAction.java:158)  
at  
org.elasticsearch.action.update.TransportUpdateAction.doExecute(TransportUpdateAction.java:153)  
at  
org.elasticsearch.action.update.TransportUpdateAction.doExecute(TransportUpdateAction.java:63)  
at  
org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:61)  
at  
org.elasticsearch.client.node.NodeClient.execute(NodeClient.java:92)  
at  
org.elasticsearch.client.support.AbstractClient.update(AbstractClient.java:109)  
at  
org.elasticsearch.action.update.UpdateRequestBuilder.doExecute(UpdateRequestBuilder.java:332)  
at  
org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:85)  
at  
org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:59)

Looking at the source of StreamOutput.writeGenericValue[https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/common/io/stream/StreamOutput.java#L339](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/common/io/stream/StreamOutput.java#L339),  
it seems only List, not Collection, is supported for marshalling. I  
resolved my issue just by copying the set to a list, but I'm wondering why  
this limitation exists.

--  
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 [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [July 6, 2017, 2:14am UTC](https://discuss.elastic.co/t/java-update-api-doesnt-support-serialization-of-collection/13789/2 "2017-07-06T02:14:25Z")

</div>


