# Is elasticsearch Querying on a field value case sensitive?

**URL:** <https://discuss.elastic.co/t/is-elasticsearch-querying-on-a-field-value-case-sensitive/74005>\
**Category:** Elasticsearch\
**Created:** [February 6, 2017, 4:13am UTC](https://discuss.elastic.co/t/is-elasticsearch-querying-on-a-field-value-case-sensitive/74005 "2017-02-06T04:13:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nethis](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@nethis](https://discuss.elastic.co/u/nethis)\
**Post date:** [February 6, 2017, 4:13am UTC](https://discuss.elastic.co/t/is-elasticsearch-querying-on-a-field-value-case-sensitive/74005/1 "2017-02-06T04:13:37Z")

</div>

Hi,

I could see some surprising behavior from elastic search , please see below.

For one index, its returning different count with different casing. For one index, it is same. Is there some setting at index level for case sensitive querying?

```
GET customevent-2017.05/_search
{
  "query": {"match": {
    "EventTemplateName": "CustomEvent"
  }}
}

```

hits : 42172940

```
GET customevent-2017.05/_search
{
  "query": {"match": {
    "EventTemplateName": "customevent"
  }}
}

```

hits : 0

```
GET customevent/_search
{
  "query": {"match": {
    "EventTemplateName": "CustomEvent"
  }}
}

```

hits : 1044672074

```
GET customevent/_search
{
  "query": {"match": {
    "EventTemplateName": "customevent"
  }}
} 

```

hits: 1044672074

---

<div class="post-metadata">

**Author:** ![nethis](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@nethis](https://discuss.elastic.co/u/nethis)\
**Post date:** [February 6, 2017, 4:53am UTC](https://discuss.elastic.co/t/is-elasticsearch-querying-on-a-field-value-case-sensitive/74005/2 "2017-02-06T04:53:27Z")

</div>

Seems I got the issue here. If field is analyzed, then the query is case insensitive. If the query is not analyzed, then it is case sensitive. Thanks.

---

<div class="post-metadata">

**Author:** ![mnozawa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mnozawa/32/15091_2.png) [@mnozawa](https://discuss.elastic.co/u/mnozawa)\
**Post date:** [February 6, 2017, 4:57am UTC](https://discuss.elastic.co/t/is-elasticsearch-querying-on-a-field-value-case-sensitive/74005/3 "2017-02-06T04:57:39Z")

</div>

Hi,

The "lowercase" token filter makes fields case-insensitive.  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-lowercase-tokenfilter.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-lowercase-tokenfilter.html)

In addition, the "Standard" analyzer includes the lowercase filter, I assume that your "analyzed" field uses this.  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-standard-analyzer.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-standard-analyzer.html)

---

<div class="post-metadata">

**Author:** ![nethis](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@nethis](https://discuss.elastic.co/u/nethis)\
**Post date:** [February 17, 2017, 4:20am UTC](https://discuss.elastic.co/t/is-elasticsearch-querying-on-a-field-value-case-sensitive/74005/4 "2017-02-17T04:20:40Z")

</div>

Got the issue here, Analyzed string is NOT case sensitive and Not Analyzed string is Case sensitive

---

<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:** [March 17, 2017, 4:20am UTC](https://discuss.elastic.co/t/is-elasticsearch-querying-on-a-field-value-case-sensitive/74005/5 "2017-03-17T04:20:50Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
