# Terms filter with the value to match in upercase is not possible?

**URL:** <https://discuss.elastic.co/t/terms-filter-with-the-value-to-match-in-upercase-is-not-possible/20901>\
**Category:** Elasticsearch\
**Created:** [November 22, 2014, 9:35pm UTC](https://discuss.elastic.co/t/terms-filter-with-the-value-to-match-in-upercase-is-not-possible/20901 "2014-11-22T21:35:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dashaus](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@dashaus](https://discuss.elastic.co/u/dashaus)\
**Post date:** [November 22, 2014, 9:35pm UTC](https://discuss.elastic.co/t/terms-filter-with-the-value-to-match-in-upercase-is-not-possible/20901/1 "2014-11-22T21:35:43Z")

</div>

Hi!,  
I have a document like this:  
{  
"type": "film",  
"countries": ["US", "ES"]  
}

And i insert it in elasticsearch, then i do the follow search:

GET \_search?search\_type=dfs\_query\_and\_fetch  
{  
"query": {  
"filtered": {  
"query": {  
"term": {"type": "film"}  
},  
"filter": {  
"query": {  
"terms": {  
"countries": [  
"US",  
"ES"  
]  
}  
}  
}  
}  
}  
}

But I get a result without the document...But if I change the "terms" filter  
to...

....  
"terms": {  
"countries": [  
"us",  
"es"  
]  
}  
....

Then I get a result with the document! So, this is a bug or is a desired  
behavior?

Thanks!

Cheers,  
Emilio

--  
View this message in context: [http://elasticsearch-users.115913.n3.nabble.com/terms-filter-with-the-value-to-match-in-upercase-is-not-possible-tp4066613.html](http://elasticsearch-users.115913.n3.nabble.com/terms-filter-with-the-value-to-match-in-upercase-is-not-possible-tp4066613.html)  
Sent from the ElasticSearch Users mailing list archive at [Nabble.com](http://Nabble.com).

--  
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/1416692143551-4066613.post%40n3.nabble.com](https://groups.google.com/d/msgid/elasticsearch/1416692143551-4066613.post%40n3.nabble.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 24, 2014, 5:44am UTC](https://discuss.elastic.co/t/terms-filter-with-the-value-to-match-in-upercase-is-not-possible/20901/2 "2014-11-24T05:44:50Z")

</div>

A term query will not analyze the search terms, so if your countries field  
is using the default analyze, there will be no match since the standard  
analyzer will lowercase the terms. Either set your field as not\_analyzed or  
use another query such as match.

--  
Ivan

On Sat, Nov 22, 2014 at 4:35 PM, dashaus [emili.tfe@gmail.com](mailto:emili.tfe@gmail.com) wrote:

> Hi!,  
> I have a document like this:  
> {  
> "type": "film",  
> "countries": ["US", "ES"]  
> }
> 
> And i insert it in elasticsearch, then i do the follow search:
> 
> GET \_search?search\_type=dfs\_query\_and\_fetch  
> {  
> "query": {  
> "filtered": {  
> "query": {  
> "term": {"type": "film"}  
> },  
> "filter": {  
> "query": {  
> "terms": {  
> "countries": [  
> "US",  
> "ES"  
> ]  
> }  
> }  
> }  
> }  
> }  
> }
> 
> But I get a result without the document...But if I change the "terms"  
> filter  
> to...
> 
> ....  
> "terms": {  
> "countries": [  
> "us",  
> "es"  
> ]  
> }  
> ....
> 
> Then I get a result with the document! So, this is a bug or is a desired  
> behavior?
> 
> Thanks!
> 
> Cheers,  
> Emilio
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/terms-filter-with-the-value-to-match-in-upercase-is-not-possible-tp4066613.html](http://elasticsearch-users.115913.n3.nabble.com/terms-filter-with-the-value-to-match-in-upercase-is-not-possible-tp4066613.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).
> 
> --  
> 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/1416692143551-4066613.post%40n3.nabble.com](https://groups.google.com/d/msgid/elasticsearch/1416692143551-4066613.post%40n3.nabble.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/CALY%3DcQBNeyJ%2Bx70Fy6HfEPDpCELGvWhKdJ%2BLKae1S0wpnfxeBg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBNeyJ%2Bx70Fy6HfEPDpCELGvWhKdJ%2BLKae1S0wpnfxeBg%40mail.gmail.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:48am UTC](https://discuss.elastic.co/t/terms-filter-with-the-value-to-match-in-upercase-is-not-possible/20901/3 "2017-07-06T00:48:10Z")

</div>


