# Elastic term filter not working when term contains /

**URL:** <https://discuss.elastic.co/t/elastic-term-filter-not-working-when-term-contains/107301>\
**Category:** Elasticsearch\
**Created:** [November 12, 2017, 1:09pm UTC](https://discuss.elastic.co/t/elastic-term-filter-not-working-when-term-contains/107301 "2017-11-12T13:09:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amarnadh\_Meda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amarnadh_meda/32/24107_2.png) [@Amarnadh\_Meda](https://discuss.elastic.co/u/Amarnadh_Meda)\
**Post date:** [November 12, 2017, 1:09pm UTC](https://discuss.elastic.co/t/elastic-term-filter-not-working-when-term-contains/107301/1 "2017-11-12T13:09:50Z")

</div>

Hi Team,

I have some problem when I am doing filtering with term.  
Say for Example I have a field in my index called "customer\_id" the value is : LC/2089011

When I give to search for some other customer id like

```
bool:{
"filter":[{
"term":{
    "customer_id":"2089011"
}
 }]
}

```

By the above case It found the record which contains LC/2089011. Where I do not want this. Can any one help me?

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [November 17, 2017, 11:06pm UTC](https://discuss.elastic.co/t/elastic-term-filter-not-working-when-term-contains/107301/2 "2017-11-17T23:06:33Z")

</div>

If you used default mapping and elasticsearch v5.x or above the following query might solve your problem

```auto
bool:{
  "filter":[{
    "term":{
      "customer_id.keyword":"2089011"
    }
  }]
}

```

If this doesn't work, please provide the mapping for the field `customer_id`.

---

<div class="post-metadata">

**Author:** ![xavierfacq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xavierfacq/32/8744_2.png) [@xavierfacq](https://discuss.elastic.co/u/xavierfacq)\
**Post date:** [November 18, 2017, 6:38pm UTC](https://discuss.elastic.co/t/elastic-term-filter-not-working-when-term-contains/107301/3 "2017-11-18T18:38:22Z")

</div>

hi,

Else you'll need to change your field mapping (customer\_id) to not analyzed.

---

<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:** [December 16, 2017, 6:38pm UTC](https://discuss.elastic.co/t/elastic-term-filter-not-working-when-term-contains/107301/4 "2017-12-16T18:38:30Z")

</div>

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