# ElasticSearch 2.1.2 JAR for Hadoop Integration is not working

**URL:** <https://discuss.elastic.co/t/elasticsearch-2-1-2-jar-for-hadoop-integration-is-not-working/37031>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [December 12, 2015, 4:20am UTC](https://discuss.elastic.co/t/elasticsearch-2-1-2-jar-for-hadoop-integration-is-not-working/37031 "2015-12-12T04:20:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![vivsingh](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@vivsingh](https://discuss.elastic.co/u/vivsingh)\
**Post date:** [December 12, 2015, 4:20am UTC](https://discuss.elastic.co/t/elasticsearch-2-1-2-jar-for-hadoop-integration-is-not-working/37031/1 "2015-12-12T04:20:47Z")

</div>

Hi,  
I downloaded elasticsearch2.1.2 JAR and followed the guide to configure it in Hadoop. Everything looks ok but I am getting 'CAST' error while reading from the elasticsearch source. Below is the error message-  
Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.ClassCastException: org.elasticsearch.hadoop.mr.WritableArrayWritable cannot be cast to org.apache.hadoop.io.Text

I checked the datatypes of elasticsearch and hive fields and they are in sync. I even tried to get only those columns from elasticsearch which are string type but getting the same error as above. Any idea?

---

<div class="post-metadata">

**Author:** ![vivsingh](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@vivsingh](https://discuss.elastic.co/u/vivsingh)\
**Post date:** [December 13, 2015, 5:03am UTC](https://discuss.elastic.co/t/elasticsearch-2-1-2-jar-for-hadoop-integration-is-not-working/37031/2 "2015-12-13T05:03:30Z")

</div>

Any suggestions please?

---

<div class="post-metadata">

**Author:** ![costin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/costin/32/44950_2.png) [@costin](https://discuss.elastic.co/u/costin)\
**Post date:** [December 13, 2015, 11:54pm UTC](https://discuss.elastic.co/t/elasticsearch-2-1-2-jar-for-hadoop-integration-is-not-working/37031/3 "2015-12-13T23:54:53Z")

</div>

It's not clear what is going on from your post but based on the snippet of code, it might be that you are trying to read an array of string. Note that ES doesn't differentiate between one or multiple values - in fact it treats all the same. What is the actual stacktrace (in full) and what is your table definition?

---

<div class="post-metadata">

**Author:** ![vivsingh](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@vivsingh](https://discuss.elastic.co/u/vivsingh)\
**Post date:** [December 14, 2015, 3:56am UTC](https://discuss.elastic.co/t/elasticsearch-2-1-2-jar-for-hadoop-integration-is-not-working/37031/4 "2015-12-14T03:56:37Z")

</div>

A big thanks for the reply!  
I am new to Elasticsearch. Ealsticsearch is being used to store log file info. I am not sure of the schema; though while querying the ES( GET \_mapping) I can see the field datatypes. I tried creating same field datatypes in Hive but getting the error. Below is the table definition in Hive-  
CREATE EXTERNAL TABLE Log\_Event\_ICS\_ES(  
product\_version string,  
agent\_host string,  
product\_name string,  
temp\_time\_stamp bigint,  
log\_message string,  
org\_id string,  
log\_datetime timestamp,  
message string,  
log\_source\_provider string,  
log\_source\_name string,  
log\_message\_for\_trending string,  
index\_only\_message string,  
log\_level string,  
code\_source string,  
log\_type string,  
full\_message string,  
session\_log\_operation string,  
source\_received\_time timestamp  
)  
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'  
TBLPROPERTIES('es.resource' = 'log\_event\_2015-05-11/log\_event',  
'es.nodes' = '',  
'es.port' = ''  
)  
The actual stacktrace is same what I provided- It just gives 3 lines of error message-  
Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.ClassCastException: org.elasticsearch.hadoop.mr.WritableArrayWritable cannot be cast to org.apache.hadoop.io.Text

---

<div class="post-metadata">

**Author:** ![vivsingh](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@vivsingh](https://discuss.elastic.co/u/vivsingh)\
**Post date:** [December 18, 2015, 7:46am UTC](https://discuss.elastic.co/t/elasticsearch-2-1-2-jar-for-hadoop-integration-is-not-working/37031/7 "2015-12-18T07:46:55Z")

</div>

Hi Costin,

I got some hold over ES now, the issue indeed was with the datatype. Thanks for pointing it out.

I checked with my ES source team and they confirmed on the datatype which is of array type + the individual datatypes of the field. I made the changes accordingly in hive and everything now works!!

---

<div class="post-metadata">

**Author:** ![mohan\_p](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@mohan\_p](https://discuss.elastic.co/u/mohan_p)\
**Post date:** [March 7, 2016, 2:44pm UTC](https://discuss.elastic.co/t/elasticsearch-2-1-2-jar-for-hadoop-integration-is-not-working/37031/8 "2016-03-07T14:44:05Z")

</div>

Hi Costin,  
I See data type as text in ES in mycase, but while I query from hive I see its treated as Array.

Failed with exception java.io.IOException:java.lang.ClassCastException: org.elasticsearch.hadoop.mr.WritableArrayWritable cannot be cast to org.apache.hadoop.io.Text

Same as : ElasticSearch 2.1.2 JAR for Hadoop Integration is not working

---

<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:** [July 6, 2017, 1:25pm UTC](https://discuss.elastic.co/t/elasticsearch-2-1-2-jar-for-hadoop-integration-is-not-working/37031/9 "2017-07-06T13:25:53Z")

</div>


