# Able to filter a field from document

**URL:** https://discuss.elastic.co/t/able-to-filter-a-field-from-document/20083
**Category:** Elasticsearch
**Created:** [October 6, 2014, 7:02am UTC](https://discuss.elastic.co/t/able-to-filter-a-field-from-document/20083 "2014-10-06T07:02:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Gurvinder\_Singh](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@Gurvinder\_Singh](https://discuss.elastic.co/u/Gurvinder_Singh)
#### Post date: [October 6, 2014, 7:02am UTC](https://discuss.elastic.co/t/able-to-filter-a-field-from-document/20083/1 "2014-10-06T07:02:30Z")

</div>

I am wondering if it is possible to filter a field from a document  
using aliases. For example if I have an index with documents such as

{  
"user" : "test",  
"secret\_field": "value",  
"post\_date" : "2014-06-05T09:12:12",  
"message" : "trying out Elasticsearch"  
}

Now if I want to create an alias for this index which has all the  
documents with fields as above except the secret\_field. I can use the  
term filter in the alias creation but that works at document level and  
filters the documents based on specified terms. So I am wondering is  
there any other method to filter only field but not the whole document  
from index.

Regards,  
Gurvinder

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/54323E86.8000001%40gmail.com](https://groups.google.com/d/msgid/elasticsearch/54323E86.8000001%40gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [October 6, 2014, 7:14am UTC](https://discuss.elastic.co/t/able-to-filter-a-field-from-document/20083/2 "2014-10-06T07:14:13Z")

</div>

I'm not sure I understood what you are looking for.  
May be exclude is what you want?

See: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-source-field.html#include-exclude)

> Le 6 oct. 2014 à 09:02, Gurvinder Singh [gurvindersinghdahiya@gmail.com](mailto:gurvindersinghdahiya@gmail.com) a écrit :
> 
> I am wondering if it is possible to filter a field from a document  
> using aliases. For example if I have an index with documents such as
> 
> {  
> "user" : "test",  
> "secret\_field": "value",  
> "post\_date" : "2014-06-05T09:12:12",  
> "message" : "trying out Elasticsearch"  
> }
> 
> Now if I want to create an alias for this index which has all the  
> documents with fields as above except the secret\_field. I can use the  
> term filter in the alias creation but that works at document level and  
> filters the documents based on specified terms. So I am wondering is  
> there any other method to filter only field but not the whole document  
> from index.
> 
> Regards,  
> Gurvinder
> 
> --  
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/54323E86.8000001%40gmail.com](https://groups.google.com/d/msgid/elasticsearch/54323E86.8000001%40gmail.com).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/3C7E7F56-792C-4425-A4C0-A55A3C78D380%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/3C7E7F56-792C-4425-A4C0-A55A3C78D380%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Gurvinder\_Singh](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@Gurvinder\_Singh](https://discuss.elastic.co/u/Gurvinder_Singh)
#### Post date: [October 7, 2014, 6:26am UTC](https://discuss.elastic.co/t/able-to-filter-a-field-from-document/20083/3 "2014-10-07T06:26:20Z")

</div>

On 10/06/2014 09:14 AM, David Pilato wrote:

> I'm not sure I understood what you are looking for.  
> May be exclude is what you want?
> 
> See: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-source-field.html#include-exclude)  
> This might have worked if Elasticsearch can apply mapping seperately to  
> aliases. As it seems in version 1.3.2, the mapping is only applied to  
> the index and alias inherent that from index. So I can not use source  
> exclusion, as I want to have secret field in original index and hidden  
> in the alias.

- Gurvinder

> Le 6 oct. 2014 à 09:02, Gurvinder Singh \<[gurvindersinghdahiya@gmail.com](mailto:gurvindersinghdahiya@gmail.com)  
> [mailto:gurvindersinghdahiya@gmail.com](mailto:gurvindersinghdahiya@gmail.com)\> a écrit :
> 
> > I am wondering if it is possible to filter a field from a document  
> > using aliases. For example if I have an index with documents such as
> > 
> > {  
> > "user" : "test",  
> > "secret\_field": "value",  
> > "post\_date" : "2014-06-05T09:12:12",  
> > "message" : "trying out Elasticsearch"  
> > }
> > 
> > Now if I want to create an alias for this index which has all the  
> > documents with fields as above except the secret\_field. I can use the  
> > term filter in the alias creation but that works at document level and  
> > filters the documents based on specified terms. So I am wondering is  
> > there any other method to filter only field but not the whole document  
> > from index.
> > 
> > Regards,  
> > Gurvinder
> > 
> > --  
> > You received this message because you are subscribed to the Google  
> > Groups "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send  
> > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com)  
> > [mailto:elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/54323E86.8000001%40gmail.com](https://groups.google.com/d/msgid/elasticsearch/54323E86.8000001%40gmail.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to the Google  
> Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send  
> an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com)  
> [mailto:elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/3C7E7F56-792C-4425-A4C0-A55A3C78D380%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/3C7E7F56-792C-4425-A4C0-A55A3C78D380%40pilato.fr)  
> [https://groups.google.com/d/msgid/elasticsearch/3C7E7F56-792C-4425-A4C0-A55A3C78D380%40pilato.fr?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/3C7E7F56-792C-4425-A4C0-A55A3C78D380%40pilato.fr?utm_medium=email&utm_source=footer).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/5433878C.1090400%40gmail.com](https://groups.google.com/d/msgid/elasticsearch/5433878C.1090400%40gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:57am UTC](https://discuss.elastic.co/t/able-to-filter-a-field-from-document/20083/4 "2017-07-06T00:57:59Z")

</div>


