# How can I disable stored fields (i.e. set "stored\_fields" to "\_none\_") using the Java API Client?

**URL:** <https://discuss.elastic.co/t/how-can-i-disable-stored-fields-i-e-set-stored-fields-to-none-using-the-java-api-client/344079>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [September 28, 2023, 3:40pm UTC](https://discuss.elastic.co/t/how-can-i-disable-stored-fields-i-e-set-stored-fields-to-none-using-the-java-api-client/344079 "2023-09-28T15:40:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dsc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dsc/32/100102_2.png) [@dsc](https://discuss.elastic.co/u/dsc)\
**Post date:** [September 28, 2023, 3:40pm UTC](https://discuss.elastic.co/t/how-can-i-disable-stored-fields-i-e-set-stored-fields-to-none-using-the-java-api-client/344079/1 "2023-09-28T15:40:32Z")

</div>

The `SearchRequest` builder only lets me specify a list of stored fields (or an empty list), but no way to set it to the string `_none_`.

If I leave this as the default, or set it to an empty list, I don't get the desired behaviour.

I'm basically trying to generate a query similar to this one: [Retrieve selected fields from a search | Elasticsearch Guide [8.10] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-fields.html#disable-stored-fields)

---

<div class="post-metadata">

**Author:** ![dsc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dsc/32/100102_2.png) [@dsc](https://discuss.elastic.co/u/dsc)\
**Post date:** [October 2, 2023, 11:54am UTC](https://discuss.elastic.co/t/how-can-i-disable-stored-fields-i-e-set-stored-fields-to-none-using-the-java-api-client/344079/2 "2023-10-02T11:54:09Z")

</div>

After some more testing and reading through the source, it doesn't look like it's possible with the Java API client.

I've opened an issue for this now: [No way to set `stored_fields` to the string `_none_` using the Java API client · Issue #680 · elastic/elasticsearch-java · GitHub](https://github.com/elastic/elasticsearch-java/issues/680)

---

<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:** [October 30, 2023, 11:55am UTC](https://discuss.elastic.co/t/how-can-i-disable-stored-fields-i-e-set-stored-fields-to-none-using-the-java-api-client/344079/3 "2023-10-30T11:55:04Z")

</div>

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