Issue with select * from indexname in tableau connected to elasticsearch using JDBC

I'm using elasticsearch 6.8 and JDBC client for 6.8
when connecting to elasticsearch from tableau, and executing
select * from indexname
it is failing with following error

An error occurred while communicating with the Other Databases (JDBC) data source 'ShowData'.
Bad Connection: Tableau could not connect to the data source.
java.sql.SQLException: Server encountered an error [Index: 0, Size: 0]. [java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at java.util.ArrayList.rangeCheck(
	at java.util.ArrayList.get(
	at org.elasticsearch.xpack.sql.session.AbstractRowSet.column(
	at org.elasticsearch.xpack.sql.session.RowView.forEachColumn(
	at org.elasticsearch.xpack.sql.plugin.TransportSqlQueryAction.lambda$createResponse$2(
	at org.elasticsearch.xpack.sql.session.RowSet.forEachRow(
	at org.elasticsearch.xpack.sql.plugin.TransportSqlQueryAction.createResponse(
	at org.elasticsearch.xpack.sql.plugin.TransportSqlQueryAction.createResponse(
	at org.elasticsearch.xpack.sql.plugin.TransportSqlQueryAction.lambda$operation$0(
	at org.elasticsearch.action.ActionListener$1.onResponse(
	at org.elasticsearch.action.ActionListener$1.onResponse(
	at org.elasticsearch.action.ActionListener$1.onResponse(
	at org.elasticsearch.action.ActionListener$1.onResponse(
	at org.elasticsearch.action.ActionListener$1.onResponse(
	at org.elasticsearch.action.ActionListener$1.onResponse(
	at org.elasticsearch.action.ActionListenerResponseHandler.handleResponse(

error seems to be from elasticsearch class, any suggestions on how to get this fixed

select fieldname from indexname works well

only issue with *


Issue seems to be with a field having value as , looks like a bug with jdbc driver , and reproducable from simple java jdbc client,how can I raise a bug to elasticsearch to get this fixed ?


May be @costin would like to confirm first if it's a bug?

@ivar what is the actual value from that field? In your post you mentioned [ ]. This means the value is two square brackets with a white space between them?

Also, next time, do please format the code in your post to make it more readable.

@Andrei_Stefan it is an empty array
sure I'll format my code
the field is of type text


@ivar I tried with this data:

{"test":" "}

And on the most recent 7.x version of Elasticsearch and it doesn't reproduce. There were some fixes in this area of code, so it may be possible this one to be fixed already.

  1. Is it 6.8.0 or 6.8.1 that you are using?
  2. Any chance you could test this with latest 7.x?
  3. Is this JDBC specific, or if you send a REST request to Elasticsearch (see here more about this), you get the same error?
  4. What is the exact query you are using?
  5. Please, provide a minimal set of data and index mapping to reproduce this.

Thank you.

please find the responses

1)I'm using elasticsearch 6.8.0
2)I dont have 7.x I'll try this
3)REST is good
but observed a different issue : if a field has array with more than 1 value, SQL fails to return results
4)select * from mjdbctest
5)POST _bulk
{ "index" : { "_index" : "mjdbctest", "_type" : "_doc", "_id" : "4" } }
{ "keys" : ["key1"],"dupKeys":["dk4"]}
{ "index" : { "_index" : "mjdbctest", "_type" : "_doc", "_id" : "3" } }
{ "keys" : ,"dupKeys":["dk3"]}

Thank you. I am able to reproduce this.

More details about the issue you have here:
Regarding "array with more than 1 value, SQL fails to return results", ES SQL doesn't return more than one value and this is by design. A bit more on the subject here and here in the documentation.

Thanks @Andrei_Stefan

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