# \[Hadoop\] writing ES string array from Pig using elasticsearch-hadoop plugin

**URL:** <https://discuss.elastic.co/t/hadoop-writing-es-string-array-from-pig-using-elasticsearch-hadoop-plugin/17034>\
**Category:** Elasticsearch\
**Created:** [April 15, 2014, 9:06pm UTC](https://discuss.elastic.co/t/hadoop-writing-es-string-array-from-pig-using-elasticsearch-hadoop-plugin/17034 "2014-04-15T21:06:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allanitronage\_Ortez](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@Allanitronage\_Ortez](https://discuss.elastic.co/u/Allanitronage_Ortez)\
**Post date:** [April 15, 2014, 9:06pm UTC](https://discuss.elastic.co/t/hadoop-writing-es-string-array-from-pig-using-elasticsearch-hadoop-plugin/17034/1 "2014-04-15T21:06:24Z")

</div>

I am having problems while trying to write an ES string array from my Pig  
script. The current ES-hadoop documentation (  
[http://www.elasticsearch.org/guide/en/elasticsearch/hadoop/current/pig.html](http://www.elasticsearch.org/guide/en/elasticsearch/hadoop/current/pig.html))  
states that a pig Bag maps to a ES Array. It sounds like you should be  
able to stick all of the items you want in the array into a bag, than when  
that bag is loaded into ES it turns into an array, but this is not working  
as expected. I am using elasticsearch-hadoop (1.3 m2), hadoop 2, and  
elasticsearch 0.90.5.

## Here is an example:

% this is pseudo grunt code here:  
% test\_data = A,B,C  
data = LOAD 'test\_data' USING PigStorage (',') AS (f1: chararray, f2: chararray, f3: chararray);  
data2 = FOREACH data GENERATE TOBAG(f1, f2, f3) AS my\_fields;  
STORE data2 INTO 'dgb-1610/test' USING EsStorage();

dump data2  
({(A),(B),(C)})

describe data2  
data2: {my\_fields: {(chararray)}}

* * *

## this is what the resulting index looks like:

curl -XGET '[http://gblb-es01.dev.g2:9200/dgb-1610/test/\_mapping](http://gblb-es01.dev.g2:9200/dgb-1610/test/_mapping)'  
{  
"test": {  
"properties": {  
"my\_fields": {  
"properties": {  
"0": {  
"type": "string"  
}  
}  
}  
}  
}  
}----------------------------------------------

## but this is how I expect it to be:

{  
"test": {  
"properties": {  
"my\_fields": {  
"type": "string"  
}  
}  
}  
}  
}

--  
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/cedcaa4d-4690-4feb-94ce-aeab38bd6326%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/cedcaa4d-4690-4feb-94ce-aeab38bd6326%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:35am UTC](https://discuss.elastic.co/t/hadoop-writing-es-string-array-from-pig-using-elasticsearch-hadoop-plugin/17034/2 "2017-07-06T01:35:38Z")

</div>

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


