# Elasticsearch for Hadoop library can't read data for array of primitive type in PIG

**URL:** <https://discuss.elastic.co/t/elasticsearch-for-hadoop-library-cant-read-data-for-array-of-primitive-type-in-pig/16277>\
**Category:** Elasticsearch\
**Created:** [March 10, 2014, 11:49pm UTC](https://discuss.elastic.co/t/elasticsearch-for-hadoop-library-cant-read-data-for-array-of-primitive-type-in-pig/16277 "2014-03-10T23:49:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Juan\_Huang](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@Juan\_Huang](https://discuss.elastic.co/u/Juan_Huang)\
**Post date:** [March 10, 2014, 11:49pm UTC](https://discuss.elastic.co/t/elasticsearch-for-hadoop-library-cant-read-data-for-array-of-primitive-type-in-pig/16277/1 "2014-03-10T23:49:18Z")

</div>

I am using the ElasticSearch for Hadoop library defined in  
"[http://www.elasticsearch.org/guide/en/elasticsearch/hadoop/current/pig.html](http://www.elasticsearch.org/guide/en/elasticsearch/hadoop/current/pig.html)"  
to read data in PIG for Hadoop.

There is a field "household\_ages" defined as "short" in my index type. But  
it is actually an array since this field has multiple values.  
PUT /myindex/mytype/\_mapping  
{  
"mytype": {  
"properties": {  
...  
"household\_ages": {"type": "short"}  
}  
}  
}

An example value of the field "household\_ages" is like: [45,40,17,13]

When I run the PIG script, the script can't read the value of the field  
"household\_ages", other fields with the primitive type, or map type are  
fine. Only the field with array of primitive can't be read correctly.

Below is the PIG script:  
A = LOAD 'myindex/mytype' USING  
org.elasticsearch.hadoop.pig.EsStorage('es.nodes=localhost:9200');  
DUMP A;

The value I got for this column is "(,,,)".

Below is a complete record dumped by PIG script. I can see values are read  
properly for other fields. Only the "household\_ages" field can't get the  
data:  
(12345,[lname#Smith,fname#John],[state# NY,zip# 00000,city#New  
York,street#123 Main  
St],(,,,),[special\_clearance#true,weekly\_update#true,birthday\_greeting#false])

Does any one have any idea how to fix the issue?

Thanks,  
Juan

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/24a4092c-4f11-48d7-9ed8-7d7919e102de%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/24a4092c-4f11-48d7-9ed8-7d7919e102de%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:44am UTC](https://discuss.elastic.co/t/elasticsearch-for-hadoop-library-cant-read-data-for-array-of-primitive-type-in-pig/16277/2 "2017-07-06T01:44:23Z")

</div>

Closed on July 6, 2017, 1:44am UTC


