# Read elasticsearch with Cascading

**URL:** <https://discuss.elastic.co/t/read-elasticsearch-with-cascading/63375>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [October 19, 2016, 10:47am UTC](https://discuss.elastic.co/t/read-elasticsearch-with-cascading/63375 "2016-10-19T10:47:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ebuildy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebuildy/32/6070_2.png) [@ebuildy](https://discuss.elastic.co/u/ebuildy)\
**Post date:** [October 19, 2016, 10:47am UTC](https://discuss.elastic.co/t/read-elasticsearch-with-cascading/63375/1 "2016-10-19T10:47:36Z")

</div>

Hello guys,

I would like export elasticsearch to json via Cascading (or any hadoop tools, but I try cascading right now).

```
    Properties props = new Properties();
    props.setProperty("es.nodes.wan.only", "true");
    props.setProperty("es.output.json", "true");

    Tap events = new EsTap("127.0.0.1", 9200, "test/test", "?q=*");

```

Gives:

> Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map  
> at org.elasticsearch.hadoop.cascading.EsLocalScheme.source(EsLocalScheme.java:157)  
> at cascading.tuple.TupleEntrySchemeIterator.getNext(TupleEntrySchemeIterator.java:166)  
> at cascading.tuple.TupleEntrySchemeIterator.hasNext(TupleEntrySchemeIterator.java:139)  
> ... 7 more

Which seems normal because: [https://github.com/elastic/elasticsearch-hadoop/blob/2.4/cascading/src/main/java/org/elasticsearch/hadoop/cascading/EsLocalScheme.java#L157](https://github.com/elastic/elasticsearch-hadoop/blob/2.4/cascading/src/main/java/org/elasticsearch/hadoop/cascading/EsLocalScheme.java#L157)

---

<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:** [October 27, 2016, 9:49pm UTC](https://discuss.elastic.co/t/read-elasticsearch-with-cascading/63375/2 "2016-10-27T21:49:11Z")

</div>

This looks like a similar issue to the [one you posted about Pig](https://discuss.elastic.co/t/export-elasticsearch-to-a-json-file-with-pig/63099/3). After taking a quick look at the code, I think it's also definitely a bug. I've opened an issue [here](https://github.com/elastic/elasticsearch-hadoop/issues/885).

With this showing up twice now, I'm also planning on doing a comprehensive review of the `es.output.json` feature. It seems to be a feature that is lacking in it's tests.

---

<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/read-elasticsearch-with-cascading/63375/3 "2017-07-06T13:22:45Z")

</div>


