# How to exclude a field from a search

**URL:** <https://discuss.elastic.co/t/how-to-exclude-a-field-from-a-search/6150>\
**Category:** Elasticsearch\
**Created:** [December 13, 2011, 9:06pm UTC](https://discuss.elastic.co/t/how-to-exclude-a-field-from-a-search/6150 "2011-12-13T21:06:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![danpolites](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danpolites/32/2136_2.png) [@danpolites](https://discuss.elastic.co/u/danpolites)\
**Post date:** [December 13, 2011, 9:06pm UTC](https://discuss.elastic.co/t/how-to-exclude-a-field-from-a-search/6150/1 "2011-12-13T21:06:40Z")

</div>

I'm looking for a way to exclude a field from a search. For example, I  
have a user index with fields a, b, and c. I want to search on only  
fields a and b in most cases and occasionally search on a, b, and c.  
In my case, it would be more convenient to be able to specify the  
single field that I want to exclude form the search than to list out  
each field individually with the search query. Is there a way to do  
this?

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [December 13, 2011, 9:24pm UTC](https://discuss.elastic.co/t/how-to-exclude-a-field-from-a-search/6150/2 "2011-12-13T21:24:39Z")

</div>

Hi,

I do not think that is possible.

--  
Regards,  
Lukas

On Tuesday, December 13, 2011 at 10:06 PM, danpolites wrote:

> I'm looking for a way to exclude a field from a search. For example, I  
> have a user index with fields a, b, and c. I want to search on only  
> fields a and b in most cases and occasionally search on a, b, and c.  
> In my case, it would be more convenient to be able to specify the  
> single field that I want to exclude form the search than to list out  
> each field individually with the search query. Is there a way to do  
> this?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [December 13, 2011, 10:59pm UTC](https://discuss.elastic.co/t/how-to-exclude-a-field-from-a-search/6150/3 "2011-12-13T22:59:47Z")

</div>

Are you talking about the query\_string query, where you can specify a list  
of fields? It can potentially be implemented because we know the fields  
based on the mappings. The danger there is that people might end up  
querying a lot of fields which is expensive.

On Tue, Dec 13, 2011 at 11:06 PM, danpolites [dpolites@gmail.com](mailto:dpolites@gmail.com) wrote:

> I'm looking for a way to exclude a field from a search. For example, I  
> have a user index with fields a, b, and c. I want to search on only  
> fields a and b in most cases and occasionally search on a, b, and c.  
> In my case, it would be more convenient to be able to specify the  
> single field that I want to exclude form the search than to list out  
> each field individually with the search query. Is there a way to do  
> this?

---

<div class="post-metadata">

**Author:** ![danpolites](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danpolites/32/2136_2.png) [@danpolites](https://discuss.elastic.co/u/danpolites)\
**Post date:** [December 27, 2011, 5:35pm UTC](https://discuss.elastic.co/t/how-to-exclude-a-field-from-a-search/6150/4 "2011-12-27T17:35:23Z")

</div>

I think so. The use case is that we have a tag field that we want  
administrators to be able to search, but we don't want user search  
results to search on that field.

On Dec 13, 5:59 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> Are you talking about the query\_string query, where you can specify a list  
> of fields? It can potentially be implemented because we know the fields  
> based on the mappings. The danger there is that people might end up  
> querying a lot of fields which is expensive.
> 
> On Tue, Dec 13, 2011 at 11:06 PM, danpolites [dpoli...@gmail.com](mailto:dpoli...@gmail.com) wrote:
> 
> > I'm looking for a way to exclude a field from a search. For example, I  
> > have a user index with fields a, b, and c. I want to search on only  
> > fields a and b in most cases and occasionally search on a, b, and c.  
> > In my case, it would be more convenient to be able to specify the  
> > single field that I want to exclude form the search than to list out  
> > each field individually with the search query. Is there a way to do  
> > this?

---

<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:44am UTC](https://discuss.elastic.co/t/how-to-exclude-a-field-from-a-search/6150/5 "2017-07-06T03:44:16Z")

</div>


