# Elastic Search Case Insensitive for key

**URL:** <https://discuss.elastic.co/t/elastic-search-case-insensitive-for-key/358402>\
**Category:** Elasticsearch\
**Created:** [April 29, 2024, 8:09am UTC](https://discuss.elastic.co/t/elastic-search-case-insensitive-for-key/358402 "2024-04-29T08:09:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harinder\_Singh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/harinder_singh/32/106262_2.png) [@Harinder\_Singh](https://discuss.elastic.co/u/Harinder_Singh)\
**Post date:** [April 29, 2024, 8:09am UTC](https://discuss.elastic.co/t/elastic-search-case-insensitive-for-key/358402/1 "2024-04-29T08:09:51Z")

</div>

Hi,

I have a requirement where I need to do the Elasticsearch search case insensitivity, but need on both key and value field.

Sample Documents

```auto
POST test-index21/_doc
{
  "Name": "something"
}

```

```auto
POST test-index21/_doc
{
  "name": "something"
}

```

Need for query like below to return the above both documents

```auto
GET test-index21/_search
{
  "query": {
    "match": {
      "name": "something"
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [April 29, 2024, 9:12am UTC](https://discuss.elastic.co/t/elastic-search-case-insensitive-for-key/358402/2 "2024-04-29T09:12:14Z")

</div>

HI @Harinder_Singh,

Welcome back. Setting fields names as case insensitive at query time isn't possible [as covered in this post](https://discuss.elastic.co/t/case-insensitive-search-on-fieldnames-not-values/87097). It would be best to normalise your field names to be consistent across all of your documents.

Are you using the [standard analyzer](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-standard-analyzer.html) on your documents? If so it makes use of a lowercase filter to convert text to all lowercase, giving you the case insensitive search you need on the values.

Hope that helps!

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 29, 2024, 9:18am UTC](https://discuss.elastic.co/t/elastic-search-case-insensitive-for-key/358402/3 "2024-04-29T09:18:44Z")

</div>

Another option would be to use [field aliases](https://www.elastic.co/guide/en/elasticsearch/reference/current/field-alias.html) but definitely @carly.richmond's recommandation about normalizing your schemas is the best way.

---

<div class="post-metadata">

**Author:** ![Harinder\_Singh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/harinder_singh/32/106262_2.png) [@Harinder\_Singh](https://discuss.elastic.co/u/Harinder_Singh)\
**Post date:** [April 29, 2024, 12:09pm UTC](https://discuss.elastic.co/t/elastic-search-case-insensitive-for-key/358402/4 "2024-04-29T12:09:30Z")

</div>

Thanks for you response. Yes for Values, we are using the lowercase filter
