Elasticsearch SQL ODBC Driver error of all shards failed

I'm using Elasticsearch Odbc as driver between my C++ code and Elasticsearch engine. When firing sql select query, the shards are getting failed. Please help me through this.
Thanks in advance.

You need to provide the exact and full message and the logs.

[2021-03-30T15:42:04,127][INFO ][o.e.g.GatewayService ] [IXPUNDEVDESK02] recovered [18] indices into cluster_state
[2021-03-30T15:42:11,070][INFO ][o.e.c.r.a.AllocationService] [IXPUNDEVDESK02] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[.apm-agent-configuration][0]]]).
[2021-03-30T15:42:41,376][INFO ][o.e.c.m.MetaDataIndexTemplateService] [IXPUNDEVDESK02] adding template [.management-beats] for index patterns [.management-beats]
[2021-03-30T16:04:23,454][WARN ][r.suppressed ] [IXPUNDEVDESK02] path: /_sql, params: {}
org.elasticsearch.xpack.sql.SqlIllegalArgumentException: Unexpected failure decoding cursor
at org.elasticsearch.xpack.sql.session.Cursors.decodeFromStringWithZone(Cursors.java:97) ~[?:?]
at org.elasticsearch.xpack.sql.plugin.TransportSqlQueryAction.operation(TransportSqlQueryAction.java:85) ~[?:?]
at org.elasticsearch.xpack.sql.plugin.TransportSqlQueryAction.doExecute(TransportSqlQueryAction.java:67) ~[?:?]
at org.elasticsearch.xpack.sql.plugin.TransportSqlQueryAction.doExecute(TransportSqlQueryAction.java:45) ~[?:?]
at org.elasticsearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:153) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.xpack.security.action.filter.SecurityActionFilter.apply(SecurityActionFilter.java:123) ~[?:?]
at org.elasticsearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:151) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:129) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:64) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.client.node.NodeClient.executeLocally(NodeClient.java:94) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.client.node.NodeClient.doExecute(NodeClient.java:83) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:396) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.xpack.sql.plugin.RestSqlQueryAction.lambda$prepareRequest$0(RestSqlQueryAction.java:106) ~[?:?]
at org.elasticsearch.rest.BaseRestHandler.handleRequest(BaseRestHandler.java:108) [elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.xpack.security.rest.SecurityRestFilter.handleRequest(SecurityRestFilter.java:75) [x-pack-security-7.6.2.jar:7.6.2]
at org.elasticsearch.rest.RestController.dispatchRequest(RestController.java:227) [elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.rest.RestController.tryAllHandlers(RestController.java:309) [elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.rest.RestController.dispatchRequest(RestController.java:167) [elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.http.AbstractHttpServerTransport.dispatchRequest(AbstractHttpServerTransport.java:322) [elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.http.AbstractHttpServerTransport.handleIncomingRequest(AbstractHttpServerTransport.java:372) [elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.http.AbstractHttpServerTransport.incomingRequest(AbstractHttpServerTransport.java:301) [elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.http.netty4.Netty4HttpRequestHandler.channelRead0(Netty4HttpRequestHandler.java:54) [transport-netty4-client-7.6.2.jar:7.6.2]
at org.elasticsearch.http.netty4.Netty4HttpRequestHandler.channelRead0(Netty4HttpRequestHandler.java:29) [transport-netty4-client-7.6.2.jar:7.6.2]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at org.elasticsearch.http.netty4.Netty4HttpPipeliningHandler.channelRead(Netty4HttpPipeliningHandler.java:58) [transport-netty4-client-7.6.2.jar:7.6.2]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) [netty-codec-4.1.43.Final.jar:4.1.43.Final]
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [netty-codec-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) [netty-codec-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) [netty-codec-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:326) [netty-codec-4.1.43.Final.jar:4.1.43.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:300) [netty-codec-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:287) [netty-handler-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1422) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:931) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:700) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:600) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:554) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:514) [netty-transport-4.1.43.Final.jar:4.1.43.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1050) [netty-common-4.1.43.Final.jar:4.1.43.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-common-4.1.43.Final.jar:4.1.43.Final]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_281]
Caused by: java.io.EOFException: tried to read: 6146 bytes but this stream is limited to: 2997
at org.elasticsearch.common.io.stream.InputStreamStreamInput.ensureCanReadBytes(InputStreamStreamInput.java:121) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.common.io.stream.FilterStreamInput.ensureCanReadBytes(FilterStreamInput.java:80) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.common.io.stream.StreamInput.readArraySize(StreamInput.java:1238) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.common.io.stream.StreamInput.readArrayList(StreamInput.java:753) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.common.io.stream.StreamInput.readGenericValue(StreamInput.java:696) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.xpack.sql.session.ListCursor.(ListCursor.java:38) ~[?:?]
at org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput.readNamedWriteable(NamedWriteableAwareStreamInput.java:46) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput.readNamedWriteable(NamedWriteableAwareStreamInput.java:39) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.xpack.sql.session.Cursors.decodeFromStringWithZone(Cursors.java:94) ~[?:?]
... 64 more

Could you update your version to 7.12.0 to check if the problem is still there?

Please format your code, logs or configuration files using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:

```
CODE
```

This is the icon to use if you are not using markdown format:

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.
Please update your post.

To address the question first the following two log lines hint that there might be an issue with your strings handling: could it be that the value of the cursor attribute you receive in a response is not the same as the one you send in the subsequent request?

Edit: to rule out a corruption in the app,

I guess that should be easy to troubleshoot in your app, but in case you think the issue lies somewhere else, you could enable driver's own DEBUG logging, as documented here (note the Enable driver logging section) and share those logs.

I'd then add a note, just in case: the driver itself uses the REST API, so it's effectively a SQL/ODBC - REST gateway. If your app doesn't need to work with multiple sources/drivers, you could just connect to Elasticsearch'es REST SQL API directly. Just FYI.

Finally, indeed, upgrading to a recent version is recommended (mind the compat matrix).

Solved the issue by upgrading the version to 7.12.0.

But it is taking more time to fetch the result (in Elasticsearch 7.12.0) after firing the query than the previous version (Elasticsearch 7.6.2) and also than other RDBMS. As elastic is known for its fast retrieving speed, here it is seen to be delayed one. Are there some internal settings I need to change to improve speed of firing query & fetching results ?

Well. I know that it can take some time to "warm up" the indices but once you have sent some requests to the index, that should be fast enough.

If not, may be describe in another thread what you are doing and how slow it is. And also try to run the same query from Dev Tools using Kibana Dev Console using a pure elasticsearch "curl-a-like" query and see how fast it is.

Thank you for helping..

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