我在将字符串数组从pig写入es(使用elasticsearch hadoop)时遇到问题。当前的es-hadoop文档(http://www.elasticsearch.org/guide/en/elasticsearch/hadoop/current/pig.html)声明一个pig包Map到一个es数组,但是我没有得到预期的结果。我使用的是ElasticSearchHadoop插件版本1.3.0.m2和hadoop 2.0。
以下是显示类型Map的elasticsearch hadoop文档:http://www.elasticsearch.org/guide/en/elasticsearch/hadoop/current/pig.html#pig-类型转换
举个例子:
% register elasticsearch-hadoop plugin jar ...
% 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)}}
结果索引如下所示:
curl -XGET 'http://myhappyserver.com:9200/dgb-1610/test/_mapping'
{
"test": {
"properties": {
"my_fields": {
"properties": {
"0": {
"type": "string"
}
}
}
}
}
}
但这就是我所期望的:
{
"test": {
"properties": {
"my_fields": {
"type": "string"
}
}
}
}
}
暂无答案!
目前还没有任何答案,快来回答吧!