# IllegalStateException Error when performing multisearch

**URL:** <https://discuss.elastic.co/t/illegalstateexception-error-when-performing-multisearch/124628>\
**Category:** Elasticsearch\
**Created:** [March 19, 2018, 7:22pm UTC](https://discuss.elastic.co/t/illegalstateexception-error-when-performing-multisearch/124628 "2018-03-19T19:22:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brent\_Farrell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brent_farrell/32/62466_2.png) [@Brent\_Farrell](https://discuss.elastic.co/u/Brent_Farrell)\
**Post date:** [March 19, 2018, 7:22pm UTC](https://discuss.elastic.co/t/illegalstateexception-error-when-performing-multisearch/124628/1 "2018-03-19T19:22:43Z")

</div>

Hello,  
We perform a large number of Multisearch queries in our application and we occasionally see this error come back from Elasticsearch:

\<  
Caused by: java.lang.IllegalStateException: Negative longs unsupported, use writeLong or writeZLong for negative numbers [-1077]  
at org.elasticsearch.common.io.stream.StreamOutput.writeVLong(StreamOutput.java:220)  
at org.elasticsearch.action.bulk.BulkResponse.writeTo(BulkResponse.java:149)  
at org.elasticsearch.transport.TcpTransport.buildMessage(TcpTransport.java:1219)  
at org.elasticsearch.transport.TcpTransport.sendResponse(TcpTransport.java:1172)  
at org.elasticsearch.transport.TcpTransport.sendResponse(TcpTransport.java:1154)  
at org.elasticsearch.transport.TcpTransportChannel.sendResponse(TcpTransportChannel.java:67)  
at org.elasticsearch.transport.TcpTransportChannel.sendResponse(TcpTransportChannel.java:61)  
at org.elasticsearch.transport.DelegatingTransportChannel.sendResponse(DelegatingTransportChannel.java:60)  
at org.elasticsearch.transport.RequestHandlerRegistry$TransportChannelWrapper.sendResponse(RequestHandlerRegistry.java:108)  
at org.elasticsearch.action.support.HandledTransportAction$TransportHandler$1.onResponse(HandledTransportAction.java:68)  
at org.elasticsearch.action.support.HandledTransportAction$TransportHandler$1.onResponse(HandledTransportAction.java:64)  
at org.elasticsearch.action.bulk.TransportBulkAction$BulkOperation$1.finishHim(TransportBulkAction.java:380)  
at org.elasticsearch.action.bulk.TransportBulkAction$BulkOperation$1.onResponse(TransportBulkAction.java:361)  
at org.elasticsearch.action.bulk.TransportBulkAction$BulkOperation$1.onResponse(TransportBulkAction.java:350)  
at org.elasticsearch.action.support.TransportAction$1.onResponse(TransportAction.java:85)  
at org.elasticsearch.action.support.TransportAction$1.onResponse(TransportAction.java:81)  
at org.elasticsearch.action.support.replication.TransportReplicationAction$ReroutePhase.finishOnSuccess(TransportReplicationAction.java:936)  
at org.elasticsearch.action.support.replication.TransportReplicationAction$ReroutePhase$1.handleResponse(TransportReplicationAction.java:846)  
at org.elasticsearch.action.support.replication.TransportReplicationAction$ReroutePhase$1.handleResponse(TransportReplicationAction.java:832)  
at org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleResponse(TransportService.java:1062)  
at org.elasticsearch.transport.TransportService$DirectResponseChannel.processResponse(TransportService.java:1136)  
at org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:1126)  
at org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:1115)  
at org.elasticsearch.transport.DelegatingTransportChannel.sendResponse(DelegatingTransportChannel.java:60)  
at org.elasticsearch.transport.RequestHandlerRegistry$TransportChannelWrapper.sendResponse(RequestHandlerRegistry.java:108)  
at org.elasticsearch.action.support.replication.TransportReplicationAction$AsyncPrimaryAction$2.onResponse(TransportReplicationAction.java:400)  
at org.elasticsearch.action.support.replication.TransportReplicationAction$AsyncPrimaryAction$2.onResponse(TransportReplicationAction.java:378)  
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryResult.respond(TransportReplicationAction.java:465)  
at org.elasticsearch.action.support.replication.TransportWriteAction$WritePrimaryResult.respondIfPossible(TransportWriteAction.java:176)  
at org.elasticsearch.action.support.replication.TransportWriteAction$WritePrimaryResult.respond(TransportWriteAction.java:167)  
at org.elasticsearch.action.support.replication.TransportReplicationAction$AsyncPrimaryAction.lambda$onResponse$0(TransportReplicationAction.java:356)  
at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:59)  
at org.elasticsearch.action.support.replication.ReplicationOperation.finish(ReplicationOperation.java:268)  
at org.elasticsearch.action.support.replication.ReplicationOperation.decPendingAndFinishIfNeeded(ReplicationOperation.java:249)  
at org.elasticsearch.action.support.replication.ReplicationOperation.execute(ReplicationOperation.java:126)  
at org.elasticsearch.action.support.replication.TransportReplicationAction$AsyncPrimaryAction.onResponse(TransportReplicationAction.java:358)  
at org.elasticsearch.action.support.replication.TransportReplicationAction$AsyncPrimaryAction.onResponse(TransportReplicationAction.java:298)  
at org.elasticsearch.action.support.replication.TransportReplicationAction$1.onResponse(TransportReplicationAction.java:974)  
at org.elasticsearch.action.support.replication.TransportReplicationAction$1.onResponse(TransportReplicationAction.java:971)  
at org.elasticsearch.index.shard.IndexShardOperationPermits.acquire(IndexShardOperationPermits.java:238)  
at org.elasticsearch.index.shard.IndexShard.acquirePrimaryOperationPermit(IndexShard.java:2188)  
at org.elasticsearch.action.support.replication.TransportReplicationAction.acquirePrimaryShardReference(TransportReplicationAction.java:983)  
at org.elasticsearch.action.support.replication.TransportReplicationAction.access$500(TransportReplicationAction.java:97)  
at org.elasticsearch.action.support.replication.TransportReplicationAction$AsyncPrimaryAction.doRun(TransportReplicationAction.java:319)  
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)  
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryOperationTransportHandler.messageReceived(TransportReplicationAction.java:294)  
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryOperationTransportHandler.messageReceived(TransportReplicationAction.java:281)  
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:66)  
at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:659)  
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:638)  
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)  
at java.lang.Thread.run(Thread.java:745)  
/\>

We see this with Elasticsearch 6.0. I have found similar issues on Github but none that have the error originating in the same area of code as this. What could causes this error? Right now it only happens on one server which is a single node Elasticsearch installation with no replicas or shards for the index that is being searched. Have we encountered a bug?

---

<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:** [April 16, 2018, 7:23pm UTC](https://discuss.elastic.co/t/illegalstateexception-error-when-performing-multisearch/124628/2 "2018-04-16T19:23:10Z")

</div>

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