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


(Juan Huang) #1

I am using the ElasticSearch for Hadoop library defined in
"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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/24a4092c-4f11-48d7-9ed8-7d7919e102de%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2