Bulk update request results in java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map


(Stine) #1

Hi,

when I do this bulk update request:

        transportClient.prepareIndex("index", "type", 

"1").setSource("name", "Anna").execute().actionGet();
transportClient.prepareIndex("index", "type",
"2").setSource("name", "Peter").execute().actionGet();

        final BulkRequestBuilder bulkRequest = 

transportClient.prepareBulk();
bulkRequest.add(transportClient.prepareUpdate("index", "type",
"1").setScript("ctx._source.age=age;").addScriptParam("age", 24));
bulkRequest.add(transportClient.prepareUpdate("index", "type",
"2").setScript("ctx._source.age=age;").addScriptParam("age", 35));
bulkRequest.execute().actionGet();

I get a ClassCastException:

java.lang.ClassCastException: java.lang.String cannot be cast to
java.util.Map
at
org.elasticsearch.common.io.stream.StreamInput.readMap(StreamInput.java:304)
at
org.elasticsearch.transport.TransportRequest.readFrom(TransportRequest.java:86)
at org.elasticsearch.action.ActionRequest.readFrom(ActionRequest.java:69)
at
org.elasticsearch.action.support.replication.ShardReplicationOperationRequest.readFrom(ShardReplicationOperationRequest.java:160)
at
org.elasticsearch.action.index.IndexRequest.readFrom(IndexRequest.java:609)
at org.elasticsearch.action.bulk.BulkRequest.readFrom(BulkRequest.java:437)
at
org.elasticsearch.transport.netty.MessageChannelHandler.handleRequest(MessageChannelHandler.java:204)
at
org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:108)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
at
org.elasticsearch.common.netty.OpenChannelsHandler.handleUpstream(OpenChannelsHandler.java:74)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:107)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)

Any idea what I am doing wrong?

Thanks,
Stine

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/48161ae3-e09f-4554-b73f-df5ce15e960c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Alexander Reelsen) #2

Hey,

looks ok from my birds eye view, can you tell us which elasticsearch
version you are using, so we can try and reproduce?

--Alex

On Tue, Nov 26, 2013 at 9:05 PM, Stine stinesplace@gmail.com wrote:

Hi,

when I do this bulk update request:

        transportClient.prepareIndex("index", "type",

"1").setSource("name", "Anna").execute().actionGet();
transportClient.prepareIndex("index", "type",
"2").setSource("name", "Peter").execute().actionGet();

        final BulkRequestBuilder bulkRequest =

transportClient.prepareBulk();
bulkRequest.add(transportClient.prepareUpdate("index", "type",
"1").setScript("ctx._source.age=age;").addScriptParam("age", 24));
bulkRequest.add(transportClient.prepareUpdate("index", "type",
"2").setScript("ctx._source.age=age;").addScriptParam("age", 35));
bulkRequest.execute().actionGet();

I get a ClassCastException:

java.lang.ClassCastException: java.lang.String cannot be cast to
java.util.Map
at
org.elasticsearch.common.io.stream.StreamInput.readMap(StreamInput.java:304)
at
org.elasticsearch.transport.TransportRequest.readFrom(TransportRequest.java:86)
at org.elasticsearch.action.ActionRequest.readFrom(ActionRequest.java:69)
at
org.elasticsearch.action.support.replication.ShardReplicationOperationRequest.readFrom(ShardReplicationOperationRequest.java:160)
at
org.elasticsearch.action.index.IndexRequest.readFrom(IndexRequest.java:609)
at org.elasticsearch.action.bulk.BulkRequest.readFrom(BulkRequest.java:437)
at
org.elasticsearch.transport.netty.MessageChannelHandler.handleRequest(MessageChannelHandler.java:204)
at
org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:108)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)
at
org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
at
org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
at
org.elasticsearch.common.netty.OpenChannelsHandler.handleUpstream(OpenChannelsHandler.java:74)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at
org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:107)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312)
at
org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88)
at
org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
at
org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at
org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)

Any idea what I am doing wrong?

Thanks,
Stine

--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/48161ae3-e09f-4554-b73f-df5ce15e960c%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGCwEM8GBq0sZShLJC22HwFfsAhE%2BZpWVX2H_ijV8yDD5g5K6g%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Stine Søndergaard) #3

It was 0.90.7 :slight_smile:

On 27 Nov 2013, at 11:17, Alexander Reelsen alr@spinscale.de wrote:

Hey,

looks ok from my birds eye view, can you tell us which elasticsearch version you are using, so we can try and reproduce?

--Alex

On Tue, Nov 26, 2013 at 9:05 PM, Stine stinesplace@gmail.com wrote:
Hi,

when I do this bulk update request:

        transportClient.prepareIndex("index", "type", "1").setSource("name", "Anna").execute().actionGet();
        transportClient.prepareIndex("index", "type", "2").setSource("name", "Peter").execute().actionGet();

        final BulkRequestBuilder bulkRequest = transportClient.prepareBulk();
        bulkRequest.add(transportClient.prepareUpdate("index", "type", "1").setScript("ctx._source.age=age;").addScriptParam("age", 24));
        bulkRequest.add(transportClient.prepareUpdate("index", "type", "2").setScript("ctx._source.age=age;").addScriptParam("age", 35));
        bulkRequest.execute().actionGet();

I get a ClassCastException:

java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map
at org.elasticsearch.common.io.stream.StreamInput.readMap(StreamInput.java:304)
at org.elasticsearch.transport.TransportRequest.readFrom(TransportRequest.java:86)
at org.elasticsearch.action.ActionRequest.readFrom(ActionRequest.java:69)
at org.elasticsearch.action.support.replication.ShardReplicationOperationRequest.readFrom(ShardReplicationOperationRequest.java:160)
at org.elasticsearch.action.index.IndexRequest.readFrom(IndexRequest.java:609)
at org.elasticsearch.action.bulk.BulkRequest.readFrom(BulkRequest.java:437)
at org.elasticsearch.transport.netty.MessageChannelHandler.handleRequest(MessageChannelHandler.java:204)
at org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:108)
at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)
at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)
at org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
at org.elasticsearch.common.netty.OpenChannelsHandler.handleUpstream(OpenChannelsHandler.java:74)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:107)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88)
at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)

Any idea what I am doing wrong?

Thanks,
Stine

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/48161ae3-e09f-4554-b73f-df5ce15e960c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elasticsearch/pNFCR-Iaims/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGCwEM8GBq0sZShLJC22HwFfsAhE%2BZpWVX2H_ijV8yDD5g5K6g%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/50632FC2-7B60-4F46-B198-A7477A7708D1%40stinesplace.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Jörg Prante) #4

Is the exception reproducible? If not, it may be a race condition inherent
to bulk update operations executing in parallel on replica shards.

Can you try if setting replica level 0 will work without error?

Jörg

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHkLBsGztsak_Yn7Wt9KJBFmTMhTSwPv%2BD49d8efCby5w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Stine Søndergaard) #5

This is really embarrassing! When I was just trying to reproduce the error it worked just fine! Think I must have been running version 0.90.1 yesterday when I actually thought I was running version 0.90.7. When doing that I am indeed able to reproduce the error. I am so sorry for wasting peoples time. Thanks a lot for your messages though.

-Stine

On 27 Nov 2013, at 16:11, joergprante@gmail.com wrote:

Is the exception reproducible? If not, it may be a race condition inherent to bulk update operations executing in parallel on replica shards.

Can you try if setting replica level 0 will work without error?

Jörg

--
You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elasticsearch/pNFCR-Iaims/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHkLBsGztsak_Yn7Wt9KJBFmTMhTSwPv%2BD49d8efCby5w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/8952A20E-47CC-4FDF-839D-7AC59CD1A169%40stinesplace.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Jörg Prante) #6

You're welcome.

This sounds odd but I'm glad to hear about failures and exceptions, even
non-reproducible ones or old ones. This helps to identify flaws and make ES
better and this is surely not a waste of time.

Jörg

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGsNy4NjvDnK1bDS2EtGqDJzcKmy5Xo%3DxHPC6VXBFXQSg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #7