# Retrieve stored fields from elastic search via elasticsearch hadoop connector

**URL:** https://discuss.elastic.co/t/retrieve-stored-fields-from-elastic-search-via-elasticsearch-hadoop-connector/104406
**Category:** Elasticsearch
**Tags:** es-hadoop
**Created:** [October 18, 2017, 2:06pm UTC](https://discuss.elastic.co/t/retrieve-stored-fields-from-elastic-search-via-elasticsearch-hadoop-connector/104406 "2017-10-18T14:06:31Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![edheck](https://avatars.discourse-cdn.com/v4/letter/e/9dc877/32.png) [@edheck](https://discuss.elastic.co/u/edheck)
#### Post date: [October 18, 2017, 2:06pm UTC](https://discuss.elastic.co/t/retrieve-stored-fields-from-elastic-search-via-elasticsearch-hadoop-connector/104406/1 "2017-10-18T14:06:31Z")

</div>

Here is our situation. Following is our document structure :-

```
{
   'key1': 'some_val',
   'key2': 'some_very_large_binary_value',
   ...
}

```

Because value of key2 is a large binary value and because we don't need it to be accessible in kibana and other various analytical jobs, we are excluding it from '\_src' and making it a stored field, there is only one type of analysis where we need that, when we provide the following query to get it :-

GET /\_search

```
{
    "stored_fields" : ["key2"],
    "query" : {
        "term" : { "key1" : "some_value" }
    }
}

```

This works fine until we are not using spark. With spark, the value of 'key2' comes out as null in each document.

We use spark for large scale analysis and thus the elasticsearch hadoop connector. We saw the query which is eventually generated by the connector. It looks like :-

POST /\_search?sort=\_doc&scroll=5m&size=50&\_source=key1,key2

Why is the connector putting 'key2' in '\_source' ? That's why we get null in each document retrieved.

Is there some configuration we are missing ?

---

<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: [November 15, 2017, 2:06pm UTC](https://discuss.elastic.co/t/retrieve-stored-fields-from-elastic-search-via-elasticsearch-hadoop-connector/104406/2 "2017-11-15T14:06:33Z")

</div>

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