# Get all \*STORED\* fields from a query

**URL:** <https://discuss.elastic.co/t/get-all-stored-fields-from-a-query/5961>\
**Category:** Elasticsearch\
**Created:** [November 23, 2011, 11:48pm UTC](https://discuss.elastic.co/t/get-all-stored-fields-from-a-query/5961 "2011-11-23T23:48:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ikarius](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikarius/32/3065_2.png) [@ikarius](https://discuss.elastic.co/u/ikarius)\
**Post date:** [November 23, 2011, 11:48pm UTC](https://discuss.elastic.co/t/get-all-stored-fields-from-a-query/5961/1 "2011-11-23T23:48:47Z")

</div>

Hi all,

First, i'm a beginner with ES, so .. be kind (though i've a strong background with Lucene).

I'm trying to get all the stored fields (with a mapping) in my seach. These stored fields seems to be stored alright, thic code:

```
    SearchResponse rsp = getClient().prepareSearch(INDEX_SKIMM)
            .setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
            .setQuery(q)
            .addField("firstname")  
            .setFrom(startIndex)
            .setSize(limit > MAX_RESULTS ? MAX_RESULTS : limit )
            .setExplain(true)
            .execute()
            .actionGet();

```

returns me the 'firstname' field in my SearchHit;

But, if i remove the  
.addField("firstname")  
line, i do not get **ANY** of my stored fields.

Is it normal ?

I've found a (ugly) workaround by adding this line in the search:  
.addField("\*")

and i gain access to all stored fields.

Thanks in advance for your answers !

---

<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, 3:47am UTC](https://discuss.elastic.co/t/get-all-stored-fields-from-a-query/5961/2 "2017-07-06T03:47:40Z")

</div>


