2016-09-14 36 views
0

尝试将猪的期望输出存储到弹性搜索索引中。Pig Store输出到ElasesticSearch获取错误

但是,得到的字符串索引超出范围:-1例外

预期输出: -

(google_1473682742_265278445560,{(Thu Apr 12 17:38:47 +0000 2012,190494185374220289,190494185374220289,google اااااح الاجواء بتاعت سكس حااااارر منو الفحل اللي يبي اسوي له فولو يسوي رتويت,<a href="http://blackberry.com/twitter" rel="nofollow">Twitter for BlackBerry®</a>,[hashtags#[],user_mentions#[],urls#[]],false,,0,false,),(Thu Apr 12 17:38:47 +0000 2012,190494185382608899,190494185382608899,kpit 味も素っ気もない人間とは…。,<a href="http://tapbots.com/tweetbot" rel="nofollow">Tweetbot for iOS</a>,[hashtags#[],user_mentions#[],urls#[]],false,,0,false,)}) 

描述输出; -

output: {pattern: chararray,tweets: {(lowertweets::created_at: chararray,lowertweets::id: chararray,lowertweets::id_str: chararray,lowertweets::text: chararray,lowertweets::source: chararray,lowertweets::entities: map[chararray],lowertweets::favorited: boolean,lowertweets::favorite_count: long,lowertweets::retweet_count: long,lowertweets::retweeted: boolean,lowertweets::place: map[chararray])}} 

脚本: -

STORE A INTO 'google_1473673952_265276863360/tweets' USING org.elasticsearch.hadoop.pig.EsStorage('es.nodes = ip:9200','es.mapping.pig.tuple.use.field.names = true'); 

卷曲脚本: -

curl -XPUT 'http://hostname:9200/google_1473673952_265276863360/_mapping/tweets' -d ' {  "tweets" :{  "properties" : {   "pattern" : " {"type" : "string", "store" : true}, "created_at" : {"type" : "string", "store" : true },"id" : {"type" : "string", "store" : true }, "id_str" : {"type" : "string", "store" : true },"text" : {"type" : "string", "store" : true },"source" : {"type" : "string", "store" : true },"entities" : {"type" : "string", "store" : true },"favorited" : {"type" : "boolean", "store" : true },"favorite_count" : {"type" : "string", "store" : true },"retweet_count" : {"type" : "string", "store" : true },"retweeted" : {"type" : "boolean", "store" : true },"place" : {"type" : "string", "store" : true } }}}' 

错误: -

java.lang.Exception的:产生java.io.IOException:java.lang.StringIndexOutOfBoundsException:字符串索引超出范围:-1 at org.apache.hadoop.mapred.LocalJobRunner $ Job.runTasks(LocalJobRunner.java:462)at org.apache.hadoop.mapred.LocalJobRunner $ Job.run(LocalJobRunner.java:529) :java.io.I OException:java.lang.StringIndexOutOfBoundsException:字符串索引超出范围:-1位于org.apache.pig处的org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapReduce $ Reduce.runPipeline(PigGenericMapReduce.java:479)。 backend.hadoop.executionengine.mapReduceLayer.PigGenericMapReduce $ Reduce.processOnePackageOutput(PigGenericMapReduce.java:442)

我试图通过改变卷曲的数据类型,但它并没有工作我

任何帮助

回答

0

您映射有一个错误,一个额外的“。

尝试使用此

{ "properties" : { "pattern" : {"type" : "string", "store" : true}, "created_at" : {"type" : "string", "store" : true },"id" : {"type" : "string", "store" : true }, "id_str" : {"type" : "string", "store" : true },"text" : {"type" : "string", "store" : true },"source" : {"type" : "string", "store" : true },"entities" : {"type" : "string", "store" : true },"favorited" : {"type" : "boolean", "store" : true },"favorite_count" : {"type" : "string", "store" : true },"retweet_count" : {"type" : "string", "store" : true },"retweeted" : {"type" : "boolean", "store" : true },"place" : {"type" : "string", "store" : true } }} 
+0

Ok..I纠正它,并尝试它again.But仍然得到同样的issue.java.lang.Exception:java.io.IOException异常:java.lang.StringIndexOutOfBoundsException:字符串索引超出范围:-1 org.apache.hadoop.mapred.LocalJobRunner $ Job.runTasks(LocalJobRunner.java:462)at org.apache.hadoop.mapred.LocalJobRunner $ Job.run(LocalJobRunner.java:529)引起通过:java.io.IOException:java.lang.StringIndexOutOfBoundsException:字符串索引超出范围:-1 at – Bunny