# Problem with retrieving data from Elasticsearch by Spark

**URL:** https://discuss.elastic.co/t/problem-with-retrieving-data-from-elasticsearch-by-spark/166790
**Category:** Elasticsearch
**Tags:** es-hadoop
**Created:** [February 1, 2019, 9:50pm UTC](https://discuss.elastic.co/t/problem-with-retrieving-data-from-elasticsearch-by-spark/166790 "2019-02-01T21:50:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Yasmeenc](https://avatars.discourse-cdn.com/v4/letter/y/a88e4f/32.png) [@Yasmeenc](https://discuss.elastic.co/u/Yasmeenc)
#### Post date: [February 1, 2019, 9:50pm UTC](https://discuss.elastic.co/t/problem-with-retrieving-data-from-elasticsearch-by-spark/166790/1 "2019-02-01T21:50:54Z")

</div>

Hi Team,

I'm quite new to ES and ES-Hadoop. The code for pulling the data out from ES is like below:

es\_read\_conf = {  
 "es.nodes" : "",  
 "es.port" : "80",  
 "es.resource" : 'temprollover/rollover',  
 "es.input.json": "yes"  
 }

es\_rdd = sc.newAPIHadoopRDD(  
 inputFormatClass="org.elasticsearch.hadoop.mr.EsInputFormat",  
 keyClass="org.apache.hadoop.io.NullWritable",  
 valueClass="org.elasticsearch.hadoop.mr.LinkedMapWritable",  
 conf=es\_read\_conf)

I am trying to retrieve data from Elasticsearch and trying to convert into RDD and getting the below error, Can you please help  
Traceback (most recent call last):  
File "/home/hadoop/rdd-spark.py", line 21, in   
conf=es\_read\_conf)  
File "/usr/lib/spark/python/lib/pyspark.zip/pyspark/context.py", line 751, in newAPIHadoopRDD  
File "/usr/lib/spark/python/lib/py4j-0.10.7-src.zip/py4j/java\_gateway.py", line 1257, in **call**  
File "/usr/lib/spark/python/lib/pyspark.zip/pyspark/sql/utils.py", line 63, in deco  
File "/usr/lib/spark/python/lib/py4j-0.10.7-src.zip/py4j/protocol.py", line 328, in get\_return\_value  
py4j.protocol.Py4JJavaError: An error occurred while calling z:org.apache.spark.api.python.PythonRDD.newAPIHadoopRDD.  
: org.elasticsearch.hadoop.EsHadoopIllegalArgumentException: No data nodes with HTTP-enabled available  
at org.elasticsearch.hadoop.rest.InitializationUtils.filterNonDataNodesIfNeeded(InitializationUtils.java:159)  
at org.elasticsearch.hadoop.rest.RestService.findPartitions(RestService.java:223)  
at org.elasticsearch.hadoop.mr.EsInputFormat.getSplits(EsInputFormat.java:412)

---

<div class="post-metadata">

### Author: ![james.baiera](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/james.baiera/32/10209_2.png) [@james.baiera](https://discuss.elastic.co/u/james.baiera)
#### Post date: [February 11, 2019, 9:42pm UTC](https://discuss.elastic.co/t/problem-with-retrieving-data-from-elasticsearch-by-spark/166790/2 "2019-02-11T21:42:58Z")

</div>

The error message here points to an issue with your elasticsearch cluster: ES-Hadoop cannot find any nodes that are datanodes and also support communicating over http. I would double check your deployment to ensure that those nodes exist and are reachable from ES-Hadoop.

---

<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: [March 11, 2019, 9:43pm UTC](https://discuss.elastic.co/t/problem-with-retrieving-data-from-elasticsearch-by-spark/166790/3 "2019-03-11T21:43:01Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
