I want to use MapReduce to read index from elasticsearch. I use
elasticsearch-hadoop plugin.jar in my code. Here is my code.
`public static void main(String[] args) throws Exception { Configuration
conf = new Configuration(); String query =
"twitter/tweet/_search?routing=kimchy"; conf.set("es.resource", query);
String[] otherArgs = new GenericOptionsParser(conf,
args).getRemainingArgs();
Job job = new Job(conf);
job.setInputFormatClass(ESInputFormat.class);
job.setOutputFormatClass(ESOutputFormat.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(MapWritable.class);
FileOutputFormat.setOutputPath(job, new Path(otherArgs[0]));
job.waitForCompletion(true);
}`
And when I run it, the error message was occured like this.
java.lang.Exception: java.lang.IllegalStateException: [GET] on
[twitter/tweet/_search?routing=kimchy&search_type=scan&scroll=10m&size=50&preference=_shards:0;_only_node:H9hXfcyBSjWkmtO5_Ba_ZQ]
failed; server[http://165.132.123.170:9200] returned
[{"error":"SearchPhaseExecutionException[Failed to execute phase [initial],
No indices / shards to search on, requested indices are
[twitter]]","status":500}] at
org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:354)
Caused by: java.lang.IllegalStateException: [GET] on
[twitter/tweet/_search?routing=kimchy&search_type=scan&scroll=10m&size=50&preference=_shards:0;_only_node:H9hXfcyBSjWkmtO5_Ba_ZQ]
failed; server[http://165.132.123.170:9200] returned
[{"error":"SearchPhaseExecutionException[Failed to execute phase [initial],
No indices / shards to search on, requested indices are
[twitter]]","status":500}] at
org.elasticsearch.hadoop.rest.RestClient.execute(RestClient.java:130) at
org.elasticsearch.hadoop.rest.RestClient.get(RestClient.java:73) at
org.elasticsearch.hadoop.rest.RestClient.scan(RestClient.java:159) at
org.elasticsearch.hadoop.rest.BufferedRestClient.scan(BufferedRestClient.java:78)
at org.elasticsearch.hadoop.rest.QueryBuilder.build(QueryBuilder.java:97)
at
org.elasticsearch.hadoop.mr.ESInputFormat$ShardRecordReader.next(ESInputFormat.java:211)
at
org.elasticsearch.hadoop.mr.ESInputFormat$ShardRecordReader.nextKeyValue(ESInputFormat.java:175)
at
org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.nextKeyValue(MapTask.java:531)
at org.apache.hadoop.mapreduce.MapContext.nextKeyValue(MapContext.java:67)
at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144) at
org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:764) at
org.apache.hadoop.mapred.MapTask.run(MapTask.java:364) at
org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:223)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at
java.util.concurrent.FutureTask.run(FutureTask.java:166) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
I used "twitter/tweet/_search?routing=kimchy" query string, but in the
error message it become
"twitter/tweet/_search?routing=kimchy&search_type=scan&scroll=10m&size=50&preference=_shards:0;_only_node:H9hXfcyBSjWkmtO5_Ba_ZQ",
is it normal?? I am a new in elasticsearch, please help me.........
--
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.
For more options, visit https://groups.google.com/groups/opt_out.