我遇到了将格式EsStorage存储元组存入Elasticsearch的问题。
我们举一个具体的例子:
X: {id: chararray,score: long,answers: {(id: chararray,score: long)}}
(4,385,{(7,287),(7263,48)})
我正在使用以下ESStorage配置:
DEFINE EsStorage org.elasticsearch.hadoop.pig.EsStorage (
'es.http.timeout= 5m',
'es.index.auto.create = true',
'es.mapping.pig.tuple.use.field.names = true',
'es.nodes = $es_nodes',
'es.mapping.id = id'
);
我将这些元组存储起来:
STORE X INTO '$es_index_name/$es_index_type' USING EsStorage;
结果如下:
{
"_index": "stackoverflow_test3",
"_type": "post",
"_id": "4",
"_score": 1,
"_source": {
"id": "4",
"score": 385,
"answers": [
[
{
"id": "7",
"score": 287
}
],
[
{
"id": "7263",
"score": 48
}
]
}
}
我期待有这样的事情:
{
"_index": "stackoverflow_test3",
"_type": "post",
"_id": "4",
"_score": 1,
"_source": {
"id": "4",
"score": 385,
"answers": [
{
"id": "7",
"score": 287
},
{
"id": "7263",
"score": 48
}
]
}
}
你知道我怎么能做到这一点?
谢谢