# What's the error with this simple term query?

**URL:** <https://discuss.elastic.co/t/whats-the-error-with-this-simple-term-query/9795>\
**Category:** Elasticsearch\
**Created:** [November 22, 2012, 4:46pm UTC](https://discuss.elastic.co/t/whats-the-error-with-this-simple-term-query/9795 "2012-11-22T16:46:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mauricio\_Alarcon](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@Mauricio\_Alarcon](https://discuss.elastic.co/u/Mauricio_Alarcon)\
**Post date:** [November 22, 2012, 4:46pm UTC](https://discuss.elastic.co/t/whats-the-error-with-this-simple-term-query/9795/1 "2012-11-22T16:46:33Z")

</div>

Hi guys,

I've got this so simple query that I can't make it work, I've been  
wondering if some of you can give me some insights on why it does not work?  
I've gisted it here

> <https://gist.github.com/mauricioalarcon/4132033>

Cheers

~M

--

---

<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:** [November 22, 2012, 4:57pm UTC](https://discuss.elastic.co/t/whats-the-error-with-this-simple-term-query/9795/2 "2012-11-22T16:57:09Z")

</div>

The shuttleService field is analyzed by the StandardAnalyzer, so it will be  
lowercased in the index. Term queries are not analyzed, so the search term  
is not lowercased. Matches are case-sensitive, so NOTINC!=notinc.

You can either index the field as not\_analyzed, or use an query that  
analyzes the search term such as Match.

In addition, because you are using nested documents, the field name is pckg.  
shuttleService.

Cheers,

Ivan

On Thu, Nov 22, 2012 at 8:46 AM, maverick [mauricio.alarcon@gmail.com](mailto:mauricio.alarcon@gmail.com)wrote:

> Hi guys,
> 
> I've got this so simple query that I can't make it work, I've been  
> wondering if some of you can give me some insights on why it does not work?  
> I've gisted it here
> 
> [simple text search · GitHub](https://gist.github.com/4132033)
> 
> Cheers
> 
> ~M
> 
> --

--

---

<div class="post-metadata">

**Author:** ![Mauricio\_Alarcon](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@Mauricio\_Alarcon](https://discuss.elastic.co/u/Mauricio_Alarcon)\
**Post date:** [November 22, 2012, 7:21pm UTC](https://discuss.elastic.co/t/whats-the-error-with-this-simple-term-query/9795/3 "2012-11-22T19:21:55Z")

</div>

Thank you Ivan

Indeed setting the fields as not\_analyzed solved my problem.

~M

On Thursday, November 22, 2012 11:57:12 AM UTC-5, Ivan Brusic wrote:

> The shuttleService field is analyzed by the StandardAnalyzer, so it will  
> be lowercased in the index. Term queries are not analyzed, so the search  
> term is not lowercased. Matches are case-sensitive, so NOTINC!=notinc.
> 
> You can either index the field as not\_analyzed, or use an query that  
> analyzes the search term such as Match.
> 
> In addition, because you are using nested documents, the field name is  
> pckg.shuttleService.
> 
> Cheers,
> 
> Ivan
> 
> On Thu, Nov 22, 2012 at 8:46 AM, maverick \<[mauricio...@gmail.com](mailto:mauricio...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > Hi guys,
> > 
> > I've got this so simple query that I can't make it work, I've been  
> > wondering if some of you can give me some insights on why it does not work?  
> > I've gisted it here
> > 
> > [simple text search · GitHub](https://gist.github.com/4132033)
> > 
> > Cheers
> > 
> > ~M
> > 
> > --

--

---

<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:03am UTC](https://discuss.elastic.co/t/whats-the-error-with-this-simple-term-query/9795/4 "2017-07-06T03:03:15Z")

</div>


