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


(Allanitronage Ortez) #1

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)
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'
{
"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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/cedcaa4d-4690-4feb-94ce-aeab38bd6326%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2