# Invalid target URI occurred while reading but such index/type exists

**URL:** https://discuss.elastic.co/t/invalid-target-uri-occurred-while-reading-but-such-index-type-exists/25496
**Category:** Elasticsearch
**Tags:** es-hadoop
**Created:** [July 14, 2015, 4:33am UTC](https://discuss.elastic.co/t/invalid-target-uri-occurred-while-reading-but-such-index-type-exists/25496 "2015-07-14T04:33:04Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![HeartSaVioR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/heartsavior/32/3670_2.png) [@HeartSaVioR](https://discuss.elastic.co/u/HeartSaVioR)
#### Post date: [July 14, 2015, 4:33am UTC](https://discuss.elastic.co/t/invalid-target-uri-occurred-while-reading-but-such-index-type-exists/25496/1 "2015-07-14T04:33:04Z")

</div>

I'm experimenting Spark App which reads whole ES documents from one index.  
(ES 1.2.1, Spark 1.3.0, elasticsearch-spark 2.1.0)

During experimenting, logs notify me it fails to query to whole nodes. Please see below.

```
> 15/07/14 13:18:54 ERROR NetworkClient: Node [Invalid target URI HEAD@null/<idx>/<type>}] failed (<ip1>:9200); selected next node [<ip2>:9200]
> ...
> 15/07/14 13:18:54 ERROR NetworkClient: Node [Invalid target URI HEAD@null/<idx>/<type>}] failed (<ipN>:9200); no other nodes left - aborting...

```

Below is my app codes which contains short lines.

```
val sparkConf = new SparkConf().setAppName("error-log-analyzer")
val indexName = <idx>
val typeStr = <type>
...
sparkConf.set("es.resource", s"${indexName}/${typeStr}")
sparkConf.set("es.index.auto.create", "no")
sparkConf.set("es.nodes",
  driverConf.getStringList("elasticsearch.nodes").mkString(",")
)

val sc = new SparkContext(sparkConf)
val rdd = sc.esRDD(s"${indexName}/${typeStr}}")

```

elasticsearch.nodes is `["<ip1>:9200", "<ip2>:9200", ... , "<ipN>:9200"]`.  
I'm querying `http://<ip>:9200/<idx>/<type>` with HEAD and succeed (200 OK).

Thanks in advance!

ps. My index contains some '.' and '-'. Does it matter?

---

<div class="post-metadata">

### Author: ![costin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/costin/32/44950_2.png) [@costin](https://discuss.elastic.co/u/costin)
#### Post date: [July 14, 2015, 5:28am UTC](https://discuss.elastic.co/t/invalid-target-uri-occurred-while-reading-but-such-index-type-exists/25496/2 "2015-07-14T05:28:57Z")

</div>

Can you enable logging on `org.elasticsearch.hadoop.rest` all the way to `TRACE`, re-run your script and post the logs as a gist? It looks like the hosts/nodes are not properly configured - it might be a bug or misconfiguration.  
Either way, the connector should provide a better validation instead of the cryptic error message.

Thanks,

---

<div class="post-metadata">

### Author: ![HeartSaVioR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/heartsavior/32/3670_2.png) [@HeartSaVioR](https://discuss.elastic.co/u/HeartSaVioR)
#### Post date: [July 14, 2015, 9:00am UTC](https://discuss.elastic.co/t/invalid-target-uri-occurred-while-reading-but-such-index-type-exists/25496/3 "2015-07-14T09:00:36Z")

</div>

Sure, here's gist link.

> <https://gist.github.com/HeartSaVioR/cb72582fc4743c1f68dd>

---

<div class="post-metadata">

### Author: ![ravinaik1312](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ravinaik1312/32/62486_2.png) [@ravinaik1312](https://discuss.elastic.co/u/ravinaik1312)
#### Post date: [May 14, 2017, 4:41pm UTC](https://discuss.elastic.co/t/invalid-target-uri-occurred-while-reading-but-such-index-type-exists/25496/4 "2017-05-14T16:41:37Z")

</div>

Was there a resolution found for this? I'm also getting this error. If I set "es.index.auto.create" to "true", I don't seem to get this, but it is something that I don't want to do.

---

<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, 1:22pm UTC](https://discuss.elastic.co/t/invalid-target-uri-occurred-while-reading-but-such-index-type-exists/25496/5 "2017-07-06T13:22:07Z")

</div>


