# Getting error while fetching Array field using elasticsearch-sql-cli

**URL:** <https://discuss.elastic.co/t/getting-error-while-fetching-array-field-using-elasticsearch-sql-cli/260943>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-sql\
**Created:** [January 13, 2021, 7:20am UTC](https://discuss.elastic.co/t/getting-error-while-fetching-array-field-using-elasticsearch-sql-cli/260943 "2021-01-13T07:20:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaheshMali](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@MaheshMali](https://discuss.elastic.co/u/MaheshMali)\
**Post date:** [January 13, 2021, 7:20am UTC](https://discuss.elastic.co/t/getting-error-while-fetching-array-field-using-elasticsearch-sql-cli/260943/1 "2021-01-13T07:20:49Z")

</div>

Hi Team,

I am using elasticsearch-sql-cli to fetch host.ip field value from an index called "filebeattest".  
The value of host.ip is shown as "10.1.10.24, 2603:301b:1080:e000:250:56ff:fe87:4, fe80::250:56ff:fe87:4" in Kibana GUI.

But I am getting following error when I execute the sql query:  
sql\> select "host.ip" from filebeattest;  
Server error [Server encountered an error [Arrays (returned by [host.ip]) are not supported]. [QlIllegalArgumentException[Arrays (returned by [host.ip]) are not supported]  
at org.elasticsearch.xpack.ql.execution.search.extractor.AbstractFieldHitExtractor.unwrapMultiValue(AbstractFieldHitExtractor.java:168)  
at org.elasticsearch.xpack.ql.execution.search.extractor.AbstractFieldHitExtractor.extractFromSource(AbstractFieldHitExtractor.java:262)  
at org.elasticsearch.xpack.ql.execution.search.extractor.AbstractFieldHitExtractor.extract(AbstractFieldHitExtractor.java:149)  
at org.elasticsearch.xpack.sql.execution.search.SearchHitRowSet.extractValue(SearchHitRowSet.java:128)

Can anyone please suggest any changes to make it work.

Thanks in advance,  
Mahesh

---

<div class="post-metadata">

**Author:** ![bogdan.pintea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bogdan.pintea/32/45740_2.png) [@bogdan.pintea](https://discuss.elastic.co/u/bogdan.pintea)\
**Post date:** [January 13, 2021, 2:14pm UTC](https://discuss.elastic.co/t/getting-error-while-fetching-array-field-using-elasticsearch-sql-cli/260943/2 "2021-01-13T14:14:42Z")

</div>

@MaheshMali,

You've unfortunately stepped on a bug.  
I've opened an [issue](https://github.com/elastic/elasticsearch/issues/67436) to have it fixed.  
Sorry for that.

Because of it, those fields containing multi-values (i.e. arrays) can't be selected currently with the CLI. It will work if you use the REST interface and set the [`field_multi_value_leniency`](https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-rest-fields.html) parameter to `true`, if that could be a workaround for now.

---

<div class="post-metadata">

**Author:** ![MaheshMali](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@MaheshMali](https://discuss.elastic.co/u/MaheshMali)\
**Post date:** [January 15, 2021, 11:42am UTC](https://discuss.elastic.co/t/getting-error-while-fetching-array-field-using-elasticsearch-sql-cli/260943/3 "2021-01-15T11:42:18Z")

</div>

Thank you!

---

<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:** [February 12, 2021, 11:42am UTC](https://discuss.elastic.co/t/getting-error-while-fetching-array-field-using-elasticsearch-sql-cli/260943/4 "2021-02-12T11:42:40Z")

</div>

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