# Does a field need to be indexed to filter / facet on it?

**URL:** <https://discuss.elastic.co/t/does-a-field-need-to-be-indexed-to-filter-facet-on-it/10729>\
**Category:** Elasticsearch\
**Created:** [February 13, 2013, 5:25pm UTC](https://discuss.elastic.co/t/does-a-field-need-to-be-indexed-to-filter-facet-on-it/10729 "2013-02-13T17:25:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbrianjones](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tbrianjones/32/1402_2.png) [@tbrianjones](https://discuss.elastic.co/u/tbrianjones)\
**Post date:** [February 13, 2013, 5:25pm UTC](https://discuss.elastic.co/t/does-a-field-need-to-be-indexed-to-filter-facet-on-it/10729/1 "2013-02-13T17:25:58Z")

</div>

I'd like to filter / facet on a text field that contains a code ( eg. abc,  
ab3, abz ... ). Do I need to set this field to { "index" : "analyzed" } (  
or more appropriately { "index" : "not\_analyzed" } since i'll want to  
filter on the exact string. )??? What about other field types ... numeric,  
dates, etc.

Filters seems to work fine on my development dataset ( hundreds of  
thousands of docs ) when they aren't indexed, but I've yet to test a large  
dataaset ( hundreds of millions of docs ).

I feel silly asking this question, but my other database experiences aren't  
mapping to ES as I don't have a good handle on the underlying technology  
yet.

: )

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![mattweber](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattweber/32/44940_2.png) [@mattweber](https://discuss.elastic.co/u/mattweber)\
**Post date:** [February 13, 2013, 5:44pm UTC](https://discuss.elastic.co/t/does-a-field-need-to-be-indexed-to-filter-facet-on-it/10729/2 "2013-02-13T17:44:53Z")

</div>

You are correct, if you want to filter on the exact value of a string  
field you should set it to "not\_analyzed". This is only needed on  
string fields due to tokenization of the string during indexing when  
not set.

On Wed, Feb 13, 2013 at 9:25 AM, Brian Jones [tbrianjones@gmail.com](mailto:tbrianjones@gmail.com) wrote:

> I'd like to filter / facet on a text field that contains a code ( eg. abc,  
> ab3, abz ... ). Do I need to set this field to { "index" : "analyzed" } (  
> or more appropriately { "index" : "not\_analyzed" } since i'll want to filter  
> on the exact string. )??? What about other field types ... numeric, dates,  
> etc.
> 
> Filters seems to work fine on my development dataset ( hundreds of thousands  
> of docs ) when they aren't indexed, but I've yet to test a large dataaset (  
> hundreds of millions of docs ).
> 
> I feel silly asking this question, but my other database experiences aren't  
> mapping to ES as I don't have a good handle on the underlying technology  
> yet.
> 
> : )
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:51am UTC](https://discuss.elastic.co/t/does-a-field-need-to-be-indexed-to-filter-facet-on-it/10729/3 "2017-07-06T02:51:35Z")

</div>


