嘗試將豬的期望輸出存儲到彈性搜索索引中。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)
我試圖通過改變捲曲的數據類型,但它並沒有工作我
任何幫助
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