# When using elasticsearch-hadoop plugin, IllegalStateException occured

**URL:** https://discuss.elastic.co/t/when-using-elasticsearch-hadoop-plugin-illegalstateexception-occured/12049
**Category:** Elasticsearch
**Created:** [May 21, 2013, 8:45am UTC](https://discuss.elastic.co/t/when-using-elasticsearch-hadoop-plugin-illegalstateexception-occured/12049 "2013-05-21T08:45:19Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Hoony](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@Hoony](https://discuss.elastic.co/u/Hoony)
#### Post date: [May 21, 2013, 8:45am UTC](https://discuss.elastic.co/t/when-using-elasticsearch-hadoop-plugin-illegalstateexception-occured/12049/1 "2013-05-21T08:45:19Z")

</div>

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](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](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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 2:35am UTC](https://discuss.elastic.co/t/when-using-elasticsearch-hadoop-plugin-illegalstateexception-occured/12049/2 "2017-07-06T02:35:35Z")

</div>


