# Is it possible : Terms filter by ignorecase?

**URL:** <https://discuss.elastic.co/t/is-it-possible-terms-filter-by-ignorecase/78914>\
**Category:** Elasticsearch\
**Created:** [March 16, 2017, 5:18pm UTC](https://discuss.elastic.co/t/is-it-possible-terms-filter-by-ignorecase/78914 "2017-03-16T17:18:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gautam\_Vanani](https://avatars.discourse-cdn.com/v4/letter/g/a9a28c/32.png) [@Gautam\_Vanani](https://discuss.elastic.co/u/Gautam_Vanani)\
**Post date:** [March 16, 2017, 5:18pm UTC](https://discuss.elastic.co/t/is-it-possible-terms-filter-by-ignorecase/78914/1 "2017-03-16T17:18:46Z")

</div>

I'm new in elastic search...can anyone help to create a query that will search multiple values with ignoring case.  
if I use lower case then below search query is working properly but when I use UPPER case it is not returning data so do I have to convert into lower 1st or is there any way to search by ignoring the case?

```
> {
> "query": {
> "constant_score": {
> "filter": {
> "bool": {
> "must": [
> {
> "terms": {
> "shape": [
> "ROUND",
> "HEART"
> ]
> }
> }
> ]
> }
> }
> }
> }
> }
```

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [March 16, 2017, 6:41pm UTC](https://discuss.elastic.co/t/is-it-possible-terms-filter-by-ignorecase/78914/2 "2017-03-16T18:41:18Z")

</div>

Using a `match` query will analyze the data in the same way as the text was analyzed, usually. Have a look at `analyzers` for text fields and then read about `normalizers` for keyword fields.

I don't believe there is a way to use the `terms` query with analyzed terms though. But it is fine to use `bool` with `should` clauses, usually. `terms` is required only if you have many, many terms to match. If you don't it is automatically rewritten to `bool` with `should` clauses, actually.

---

<div class="post-metadata">

**Author:** ![Gautam\_Vanani](https://avatars.discourse-cdn.com/v4/letter/g/a9a28c/32.png) [@Gautam\_Vanani](https://discuss.elastic.co/u/Gautam_Vanani)\
**Post date:** [March 16, 2017, 6:53pm UTC](https://discuss.elastic.co/t/is-it-possible-terms-filter-by-ignorecase/78914/3 "2017-03-16T18:53:50Z")

</div>

@nik9000 Thanks for reply 🙂

Yes, I have many terms to match.

I'm little bit aware of normalizers/analyzers that they are converting into lower case before indexing it and before executing query etc.  
And its good to know that terms will automatically be rewritten into bool with should clauses.

**Is there any fields to ignore case or something else?**

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [March 16, 2017, 7:01pm UTC](https://discuss.elastic.co/t/is-it-possible-terms-filter-by-ignorecase/78914/4 "2017-03-16T19:01:10Z")

</div>

> [@Gautam\_Vanani](#):
>
> I'm little bit aware of normalizers/analyzers that they are converting into lower case before indexing it and before executing query etc.

They _can_ do that if you set them up to do it.

> [@Gautam\_Vanani](#):
>
> Is there any fields to ignore case or something else?

No. At the moment you either use `terms` and lowercase on your side or use `match` inside `bool`. I don't know off hand if we've talked through a `match`-like thing that works using `terms`.

---

<div class="post-metadata">

**Author:** ![Gautam\_Vanani](https://avatars.discourse-cdn.com/v4/letter/g/a9a28c/32.png) [@Gautam\_Vanani](https://discuss.elastic.co/u/Gautam_Vanani)\
**Post date:** [March 16, 2017, 7:11pm UTC](https://discuss.elastic.co/t/is-it-possible-terms-filter-by-ignorecase/78914/5 "2017-03-16T19:11:29Z")

</div>

Let say I'm finding an object based on its shape(round, heart, pear...)  
So for multiple values how can I use `match`?

---

<div class="post-metadata">

**Author:** ![Gautam\_Vanani](https://avatars.discourse-cdn.com/v4/letter/g/a9a28c/32.png) [@Gautam\_Vanani](https://discuss.elastic.co/u/Gautam_Vanani)\
**Post date:** [March 16, 2017, 7:15pm UTC](https://discuss.elastic.co/t/is-it-possible-terms-filter-by-ignorecase/78914/6 "2017-03-16T19:15:27Z")

</div>

@nik9000 can you suggest performance wise query using `terms` is better or using(`match`) below example,

```json
{
  "size": 1000,
  "query": {
    "constant_score": {
      "filter": {
        "bool": {
          "must": [ {
              "match": {
                "shape": 
                  "round heart"
              }
            }
          ]
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [March 16, 2017, 7:31pm UTC](https://discuss.elastic.co/t/is-it-possible-terms-filter-by-ignorecase/78914/7 "2017-03-16T19:31:01Z")

</div>

> [@Gautam\_Vanani](#):
>
> @nik9000 can you suggest performance wise query using terms is better or using(match) below example,

`terms` is likely going to be faster every time but it is worth benchmarking with real data to see how much faster. Even if that benchmark is just a quick and dirty bash script with `ab`. Then you'll know how much faster. And whether or not it is worth adding something to ES. If it turns out that it is much faster for you use case we'd certainly consider adding it. I would, at least.

---

<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:** [April 13, 2017, 7:31pm UTC](https://discuss.elastic.co/t/is-it-possible-terms-filter-by-ignorecase/78914/8 "2017-04-13T19:31:11Z")

</div>

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