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

**URL:** <https://discuss.elastic.co/t/issue-with-select-from-indexname-in-tableau-connected-to-elasticsearch-using-jdbc/187692>\
**Category:** Elasticsearch\
**Created:** [June 27, 2019, 1:14am UTC](https://discuss.elastic.co/t/issue-with-select-from-indexname-in-tableau-connected-to-elasticsearch-using-jdbc/187692 "2019-06-27T01:14:31Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ivar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ivar/32/83691_2.png) [@ivar](https://discuss.elastic.co/u/ivar)\
**Post date:** [June 27, 2019, 1:14am UTC](https://discuss.elastic.co/t/issue-with-select-from-indexname-in-tableau-connected-to-elasticsearch-using-jdbc/187692/1 "2019-06-27T01:14:32Z")

</div>

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

```auto
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(ArrayList.java:653)
	at java.util.ArrayList.get(ArrayList.java:429)
	at org.elasticsearch.xpack.sql.execution.search.extractor.FieldHitExtractor.extractFromSource(FieldHitExtractor.java:185)
	at org.elasticsearch.xpack.sql.execution.search.extractor.FieldHitExtractor.extract(FieldHitExtractor.java:117)
	at org.elasticsearch.xpack.sql.execution.search.SearchHitRowSet.extractValue(SearchHitRowSet.java:111)
	at org.elasticsearch.xpack.sql.execution.search.SearchHitRowSet.extractValue(SearchHitRowSet.java:23)
	at org.elasticsearch.xpack.sql.execution.search.ResultRowSet.getColumn(ResultRowSet.java:37)
	at org.elasticsearch.xpack.sql.session.AbstractRowSet.column(AbstractRowSet.java:18)
	at org.elasticsearch.xpack.sql.session.RowView.forEachColumn(RowView.java:38)
	at org.elasticsearch.xpack.sql.plugin.TransportSqlQueryAction.lambda$createResponse$2(TransportSqlQueryAction.java:104)
	at org.elasticsearch.xpack.sql.session.RowSet.forEachRow(RowSet.java:32)
	at org.elasticsearch.xpack.sql.plugin.TransportSqlQueryAction.createResponse(TransportSqlQueryAction.java:102)
	at org.elasticsearch.xpack.sql.plugin.TransportSqlQueryAction.createResponse(TransportSqlQueryAction.java:97)
	at org.elasticsearch.xpack.sql.plugin.TransportSqlQueryAction.lambda$operation$0(TransportSqlQueryAction.java:80)
	at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:61)
	at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:61)
	at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:61)
	at org.elasticsearch.xpack.sql.execution.search.Querier$ScrollActionListener.lambda$handleResponse$0(Querier.java:499)
	at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:61)
	at org.elasticsearch.xpack.sql.execution.search.Querier$BaseActionListener.lambda$clear$3(Querier.java:606)
	at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:61)
	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.ContextPreservingActionListener.onResponse(ContextPreservingActionListener.java:43)
	at org.elasticsearch.action.search.ClearScrollController.onFreedContext(ClearScrollController.java:130)
	at org.elasticsearch.action.search.ClearScrollController.lambda$cleanScrollIds$2(ClearScrollController.java:115)
	at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:61)
	at org.elasticsearch.action.ActionListenerResponseHandler.handleResponse(ActionListenerResponseHandler.java:54)

```

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

`select fieldname from indexname works well`

only issue with `*`

Thanks

---

<div class="post-metadata">

**Author:** ![ivar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ivar/32/83691_2.png) [@ivar](https://discuss.elastic.co/u/ivar)\
**Post date:** [June 28, 2019, 5:20am UTC](https://discuss.elastic.co/t/issue-with-select-from-indexname-in-tableau-connected-to-elasticsearch-using-jdbc/187692/2 "2019-06-28T05:20:25Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 28, 2019, 5:45am UTC](https://discuss.elastic.co/t/issue-with-select-from-indexname-in-tableau-connected-to-elasticsearch-using-jdbc/187692/3 "2019-06-28T05:45:38Z")

</div>

Here:

> **[elastic/elasticsearch](https://github.com/elastic/elasticsearch)**
>
> Open Source, Distributed, RESTful Search Engine. Contribute to elastic/elasticsearch development by creating an account on GitHub.

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

---

<div class="post-metadata">

**Author:** ![Andrei\_Stefan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei_stefan/32/47533_2.png) [@Andrei\_Stefan](https://discuss.elastic.co/u/Andrei_Stefan)\
**Post date:** [June 28, 2019, 4:10pm UTC](https://discuss.elastic.co/t/issue-with-select-from-indexname-in-tableau-connected-to-elasticsearch-using-jdbc/187692/4 "2019-06-28T16:10:11Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![ivar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ivar/32/83691_2.png) [@ivar](https://discuss.elastic.co/u/ivar)\
**Post date:** [June 28, 2019, 4:58pm UTC](https://discuss.elastic.co/t/issue-with-select-from-indexname-in-tableau-connected-to-elasticsearch-using-jdbc/187692/5 "2019-06-28T16:58:03Z")

</div>

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

Thanks

---

<div class="post-metadata">

**Author:** ![Andrei\_Stefan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei_stefan/32/47533_2.png) [@Andrei\_Stefan](https://discuss.elastic.co/u/Andrei_Stefan)\
**Post date:** [June 28, 2019, 5:36pm UTC](https://discuss.elastic.co/t/issue-with-select-from-indexname-in-tableau-connected-to-elasticsearch-using-jdbc/187692/6 "2019-06-28T17:36:52Z")

</div>

@ivar I tried with this data:

```auto
{"index":{"_id":1}}
{"test":"test1"}
{"index":{"_id":2}}
{"test":"test2"}
{"index":{"_id":3}}
{"test":""}
{"index":{"_id":4}}
{"test":" "}
{"index":{"_id":5}}
{"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](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/sql-rest-overview.html) 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.

---

<div class="post-metadata">

**Author:** ![ivar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ivar/32/83691_2.png) [@ivar](https://discuss.elastic.co/u/ivar)\
**Post date:** [July 1, 2019, 3:34pm UTC](https://discuss.elastic.co/t/issue-with-select-from-indexname-in-tableau-connected-to-elasticsearch-using-jdbc/187692/7 "2019-07-01T15:34:46Z")

</div>

@Andrei_Stefan  
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"]}

---

<div class="post-metadata">

**Author:** ![Andrei\_Stefan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei_stefan/32/47533_2.png) [@Andrei\_Stefan](https://discuss.elastic.co/u/Andrei_Stefan)\
**Post date:** [July 2, 2019, 9:47am UTC](https://discuss.elastic.co/t/issue-with-select-from-indexname-in-tableau-connected-to-elasticsearch-using-jdbc/187692/8 "2019-07-02T09:47:36Z")

</div>

Thank you. I am able to reproduce this.

---

<div class="post-metadata">

**Author:** ![Andrei\_Stefan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei_stefan/32/47533_2.png) [@Andrei\_Stefan](https://discuss.elastic.co/u/Andrei_Stefan)\
**Post date:** [July 2, 2019, 10:15am UTC](https://discuss.elastic.co/t/issue-with-select-from-indexname-in-tableau-connected-to-elasticsearch-using-jdbc/187692/9 "2019-07-02T10:15:47Z")

</div>

More details about the issue you have here: [https://github.com/elastic/elasticsearch/issues/43863](https://github.com/elastic/elasticsearch/issues/43863).  
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](https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-limitations.html#_array_type_of_fields) and [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-jdbc.html#_mapping) in the documentation.

---

<div class="post-metadata">

**Author:** ![ivar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ivar/32/83691_2.png) [@ivar](https://discuss.elastic.co/u/ivar)\
**Post date:** [July 8, 2019, 4:10pm UTC](https://discuss.elastic.co/t/issue-with-select-from-indexname-in-tableau-connected-to-elasticsearch-using-jdbc/187692/10 "2019-07-08T16:10:11Z")

</div>

Thanks @Andrei_Stefan

---

<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:** [August 5, 2019, 4:10pm UTC](https://discuss.elastic.co/t/issue-with-select-from-indexname-in-tableau-connected-to-elasticsearch-using-jdbc/187692/11 "2019-08-05T16:10:18Z")

</div>

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