# Newbie question about analyzed vs not analyzed

**URL:** https://discuss.elastic.co/t/newbie-question-about-analyzed-vs-not-analyzed/15286
**Category:** Elasticsearch
**Created:** [January 17, 2014, 1:44am UTC](https://discuss.elastic.co/t/newbie-question-about-analyzed-vs-not-analyzed/15286 "2014-01-17T01:44:44Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Bob\_Ngu](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@Bob\_Ngu](https://discuss.elastic.co/u/Bob_Ngu)
#### Post date: [January 17, 2014, 1:44am UTC](https://discuss.elastic.co/t/newbie-question-about-analyzed-vs-not-analyzed/15286/1 "2014-01-17T01:44:44Z")

</div>

I am just learning ES and would appreciate a quick explanation on analyzed  
vs not analyzed searches. My basic understanding is that unless indicated  
otherwise, fields are analyzed during indexing time but when it comes to  
search time, a term query matches documents for terms that are not  
analyzed, hence it must match exactly. I am not sure what that means  
exactly because for one, the fields are already analyzed and tokenized  
during indexing time, secondly, when I execute a term query, it only  
matches in lowercase but with match or query\_string queries, they are case  
insensitive. Any insights will be much appreciated.

Thanks,  
Bob

--  
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/65638a99-eda4-4d90-8913-fb89380e63ae%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/65638a99-eda4-4d90-8913-fb89380e63ae%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Bob\_Ngu](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@Bob\_Ngu](https://discuss.elastic.co/u/Bob_Ngu)
#### Post date: [January 17, 2014, 2:07am UTC](https://discuss.elastic.co/t/newbie-question-about-analyzed-vs-not-analyzed/15286/2 "2014-01-17T02:07:52Z")

</div>

Oh I think I get it now, the analyzed value in the index is all lowercase  
and hence the exact match must be lowercase for an exact match using term  
query. When using match query, the term is first analyzed making it  
lowercase before doing the search, hence case insensitive. Am I right?

On Thursday, January 16, 2014, Bob [bobngu@gmail.com](mailto:bobngu@gmail.com) wrote:

> I am just learning ES and would appreciate a quick explanation on analyzed  
> vs not analyzed searches. My basic understanding is that unless indicated  
> otherwise, fields are analyzed during indexing time but when it comes to  
> search time, a term query matches documents for terms that are not  
> analyzed, hence it must match exactly. I am not sure what that means  
> exactly because for one, the fields are already analyzed and tokenized  
> during indexing time, secondly, when I execute a term query, it only  
> matches in lowercase but with match or query\_string queries, they are case  
> insensitive. Any insights will be much appreciated.
> 
> Thanks,  
> Bob
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/Fs5ZN-JpCdo/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Fs5ZN-JpCdo/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) \<javascript:\_e({}, 'cvml',  
> 'elasticsearch%2Bunsubscribe@googlegroups.com');\>.  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/65638a99-eda4-4d90-8913-fb89380e63ae%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/65638a99-eda4-4d90-8913-fb89380e63ae%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAFANT4%2BetJ%3DmQZA1nB29v%3D%2BCfK%3DAOXCLtd1gmE7VTx-X7VRpDA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFANT4%2BetJ%3DmQZA1nB29v%3D%2BCfK%3DAOXCLtd1gmE7VTx-X7VRpDA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)
#### Post date: [January 17, 2014, 2:22am UTC](https://discuss.elastic.co/t/newbie-question-about-analyzed-vs-not-analyzed/15286/3 "2014-01-17T02:22:08Z")

</div>

Correct. A term query does not analyze the terms, while a match query does.  
Generally, you should use text queries on non-analyzed fields, and match  
queries on analyzed ones. Analysis does not always mean lowercasing terms,  
but that is what the default (standard) analyzer does. All these concepts  
derive from Lucene.

Cheers,

Ivan

On Thu, Jan 16, 2014 at 6:07 PM, Bob Ngu [bobngu@gmail.com](mailto:bobngu@gmail.com) wrote:

> Oh I think I get it now, the analyzed value in the index is all lowercase  
> and hence the exact match must be lowercase for an exact match using term  
> query. When using match query, the term is first analyzed making it  
> lowercase before doing the search, hence case insensitive. Am I right?
> 
> On Thursday, January 16, 2014, Bob [bobngu@gmail.com](mailto:bobngu@gmail.com) wrote:
> 
> > I am just learning ES and would appreciate a quick explanation on  
> > analyzed vs not analyzed searches. My basic understanding is that unless  
> > indicated otherwise, fields are analyzed during indexing time but when it  
> > comes to search time, a term query matches documents for terms that are not  
> > analyzed, hence it must match exactly. I am not sure what that means  
> > exactly because for one, the fields are already analyzed and tokenized  
> > during indexing time, secondly, when I execute a term query, it only  
> > matches in lowercase but with match or query\_string queries, they are case  
> > insensitive. Any insights will be much appreciated.
> > 
> > Thanks,  
> > Bob
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/Fs5ZN-JpCdo/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Fs5ZN-JpCdo/unsubscribe).  
> > To unsubscribe from this group and all its topics, 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/65638a99-eda4-4d90-8913-fb89380e63ae%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/65638a99-eda4-4d90-8913-fb89380e63ae%40googlegroups.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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAFANT4%2BetJ%3DmQZA1nB29v%3D%2BCfK%3DAOXCLtd1gmE7VTx-X7VRpDA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFANT4%2BetJ%3DmQZA1nB29v%3D%2BCfK%3DAOXCLtd1gmE7VTx-X7VRpDA%40mail.gmail.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDVoxCVQFt1g%3DFrNAa\_o9xXD3kw%2BPQL0hUk5V%2BSSuPyvQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDVoxCVQFt1g%3DFrNAa_o9xXD3kw%2BPQL0hUk5V%2BSSuPyvQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)
#### Post date: [January 17, 2014, 2:23am UTC](https://discuss.elastic.co/t/newbie-question-about-analyzed-vs-not-analyzed/15286/4 "2014-01-17T02:23:21Z")

</div>

Correction: meant to say use _term_ queries on non-analyzed fields, not  
_text_ queries.

On Thu, Jan 16, 2014 at 6:22 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> Correct. A term query does not analyze the terms, while a match query  
> does. Generally, you should use text queries on non-analyzed fields, and  
> match queries on analyzed ones. Analysis does not always mean lowercasing  
> terms, but that is what the default (standard) analyzer does. All these  
> concepts derive from Lucene.
> 
> Cheers,
> 
> Ivan
> 
> On Thu, Jan 16, 2014 at 6:07 PM, Bob Ngu [bobngu@gmail.com](mailto:bobngu@gmail.com) wrote:
> 
> > Oh I think I get it now, the analyzed value in the index is all lowercase  
> > and hence the exact match must be lowercase for an exact match using term  
> > query. When using match query, the term is first analyzed making it  
> > lowercase before doing the search, hence case insensitive. Am I right?
> > 
> > On Thursday, January 16, 2014, Bob [bobngu@gmail.com](mailto:bobngu@gmail.com) wrote:
> > 
> > > I am just learning ES and would appreciate a quick explanation on  
> > > analyzed vs not analyzed searches. My basic understanding is that unless  
> > > indicated otherwise, fields are analyzed during indexing time but when it  
> > > comes to search time, a term query matches documents for terms that are not  
> > > analyzed, hence it must match exactly. I am not sure what that means  
> > > exactly because for one, the fields are already analyzed and tokenized  
> > > during indexing time, secondly, when I execute a term query, it only  
> > > matches in lowercase but with match or query\_string queries, they are case  
> > > insensitive. Any insights will be much appreciated.
> > > 
> > > Thanks,  
> > > Bob
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/Fs5ZN-JpCdo/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Fs5ZN-JpCdo/unsubscribe).  
> > > To unsubscribe from this group and all its topics, 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/65638a99-eda4-4d90-8913-fb89380e63ae%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/65638a99-eda4-4d90-8913-fb89380e63ae%40googlegroups.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).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAFANT4%2BetJ%3DmQZA1nB29v%3D%2BCfK%3DAOXCLtd1gmE7VTx-X7VRpDA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFANT4%2BetJ%3DmQZA1nB29v%3D%2BCfK%3DAOXCLtd1gmE7VTx-X7VRpDA%40mail.gmail.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC9dmr%2BsD\_y%3DuuRYr\_Am2sQ-svXBaVutphM61%2BD%3D\_3%2Bgw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC9dmr%2BsD_y%3DuuRYr_Am2sQ-svXBaVutphM61%2BD%3D_3%2Bgw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Bob\_Ngu](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@Bob\_Ngu](https://discuss.elastic.co/u/Bob_Ngu)
#### Post date: [January 17, 2014, 4:02am UTC](https://discuss.elastic.co/t/newbie-question-about-analyzed-vs-not-analyzed/15286/5 "2014-01-17T04:02:53Z")

</div>

Yep, thanks for confirming my understanding, in the case of using term  
queries on non-analyzed fields, the search value must match the exact case  
of the original value if I understand this correctly.

Bob  
On Jan 16, 2014, at 6:23 PM, Ivan Brusic  
\<[ivan@brusic.com](mailto:ivan@brusic.com)\<javascript:\_e({}, 'cvml', 'ivan@brusic.com');\>\>  
wrote:

Correction: meant to say use _term_ queries on non-analyzed fields, not  
_text_ queries.

On Thu, Jan 16, 2014 at 6:22 PM, Ivan Brusic  
\<[ivan@brusic.com](mailto:ivan@brusic.com)\<javascript:\_e({}, 'cvml', 'ivan@brusic.com');\>

> wrote:

> Correct. A term query does not analyze the terms, while a match query  
> does. Generally, you should use text queries on non-analyzed fields, and  
> match queries on analyzed ones. Analysis does not always mean lowercasing  
> terms, but that is what the default (standard) analyzer does. All these  
> concepts derive from Lucene.
> 
> Cheers,
> 
> Ivan
> 
> On Thu, Jan 16, 2014 at 6:07 PM, Bob Ngu \<[bobngu@gmail.com](mailto:bobngu@gmail.com)\<javascript:\_e({}, 'cvml', 'bobngu@gmail.com');\>
> 
> > wrote:
> 
> > Oh I think I get it now, the analyzed value in the index is all lowercase  
> > and hence the exact match must be lowercase for an exact match using term  
> > query. When using match query, the term is first analyzed making it  
> > lowercase before doing the search, hence case insensitive. Am I right?
> > 
> > On Thursday, January 16, 2014, Bob \<[bobngu@gmail.com](mailto:bobngu@gmail.com) \<javascript:\_e({},  
> > 'cvml', 'bobngu@gmail.com');\>\> wrote:
> > 
> > > I am just learning ES and would appreciate a quick explanation on  
> > > analyzed vs not analyzed searches. My basic understanding is that unless  
> > > indicated otherwise, fields are analyzed during indexing time but when it  
> > > comes to search time, a term query matches documents for terms that are not  
> > > analyzed, hence it must match exactly. I am not sure what that means  
> > > exactly because for one, the fields are already analyzed and tokenized  
> > > during indexing time, secondly, when I execute a term query, it only  
> > > matches in lowercase but with match or query\_string queries, they are case  
> > > insensitive. Any insights will be much appreciated.
> > > 
> > > Thanks,  
> > > Bob
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/Fs5ZN-JpCdo/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Fs5ZN-JpCdo/unsubscribe).  
> > > To unsubscribe from this group and all its topics, 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/65638a99-eda4-4d90-8913-fb89380e63ae%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/65638a99-eda4-4d90-8913-fb89380e63ae%40googlegroups.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) \<javascript:\_e({},  
> > 'cvml', 'elasticsearch%2Bunsubscribe@googlegroups.com');\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAFANT4%2BetJ%3DmQZA1nB29v%3D%2BCfK%3DAOXCLtd1gmE7VTx-X7VRpDA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFANT4%2BetJ%3DmQZA1nB29v%3D%2BCfK%3DAOXCLtd1gmE7VTx-X7VRpDA%40mail.gmail.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 a topic in the  
Google Groups "elasticsearch" group.  
To unsubscribe from this topic, visit  
[https://groups.google.com/d/topic/elasticsearch/Fs5ZN-JpCdo/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Fs5ZN-JpCdo/unsubscribe).  
To unsubscribe from this group and all its topics, send an email to  
[elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com) \<javascript:\_e({}, 'cvml',  
'elasticsearch%2Bunsubscribe@googlegroups.com');\>.  
To view this discussion on the web visit  
[https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC9dmr%2BsD\_y%3DuuRYr\_Am2sQ-svXBaVutphM61%2BD%3D\_3%2Bgw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC9dmr%2BsD_y%3DuuRYr_Am2sQ-svXBaVutphM61%2BD%3D_3%2Bgw%40mail.gmail.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAFANT4%2BF6hMvOZ1nYSM2thw2z15ENvff3Jo%3DzQAb1xp%2Bb1Exig%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFANT4%2BF6hMvOZ1nYSM2thw2z15ENvff3Jo%3DzQAb1xp%2Bb1Exig%40mail.gmail.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, 1:56am UTC](https://discuss.elastic.co/t/newbie-question-about-analyzed-vs-not-analyzed/15286/6 "2017-07-06T01:56:17Z")

</div>


