# Wrong results depended by field name

**URL:** <https://discuss.elastic.co/t/wrong-results-depended-by-field-name/41629>\
**Category:** Elasticsearch\
**Created:** [February 12, 2016, 3:21pm UTC](https://discuss.elastic.co/t/wrong-results-depended-by-field-name/41629 "2016-02-12T15:21:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bdfy1](https://avatars.discourse-cdn.com/v4/letter/b/858c86/32.png) [@Bdfy1](https://discuss.elastic.co/u/Bdfy1)\
**Post date:** [February 12, 2016, 3:21pm UTC](https://discuss.elastic.co/t/wrong-results-depended-by-field-name/41629/1 "2016-02-12T15:21:01Z")

</div>

elasticsearch 2.1.1,

index:  
`"_source":{"env" : {"flash": 1 }, "index_name" : "2016-01", "user" : { "geo" : { "country" : "ZZ" } } }`

`curl -XPOST http://127.0.0.1:9200/test/_search?pretty=1 -d' { "query" : { "bool": { "filter": { "term" : { "env.flash" : 1 } } } } }`  
return some results,

but request  
`curl -XPOST http://127.0.0.1:9200/test/_search?pretty=1 -d' { "query" : { "bool": { "filter": { "term" : { "user.geo.country" : "ZZ" } } } } }`  
or  
`curl -XPOST http://127.0.0.1:9200/test/_search?pretty=1 -d' { "query" : { "bool": { "filter": { "index_name" : "2016-01" } } } }`

return empty results. Why ?

---

<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:** [February 13, 2016, 9:21pm UTC](https://discuss.elastic.co/t/wrong-results-depended-by-field-name/41629/2 "2016-02-13T21:21:13Z")

</div>

If you are using the standard analyzer, string fields are lowercased (among  
other things). A term query requires an exact match, so an uppercase term  
such as "ZZ", while not match a field that uses the standard analyzer.  
"2016-01" is probably split into two tokens.

Either make the fields as non-analyzed or use a query that analyzes the  
terms, such as a match query. It depends on your use case.

Ivan

---

<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 5, 2017, 11:16pm UTC](https://discuss.elastic.co/t/wrong-results-depended-by-field-name/41629/3 "2017-07-05T23:16:35Z")

</div>


