# Problem with filter when term is with letters and numbers

**URL:** <https://discuss.elastic.co/t/problem-with-filter-when-term-is-with-letters-and-numbers/38340>\
**Category:** Elasticsearch\
**Created:** [January 4, 2016, 6:04pm UTC](https://discuss.elastic.co/t/problem-with-filter-when-term-is-with-letters-and-numbers/38340 "2016-01-04T18:04:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![guamgarten](https://avatars.discourse-cdn.com/v4/letter/g/c68b51/32.png) [@guamgarten](https://discuss.elastic.co/u/guamgarten)\
**Post date:** [January 4, 2016, 6:04pm UTC](https://discuss.elastic.co/t/problem-with-filter-when-term-is-with-letters-and-numbers/38340/1 "2016-01-04T18:04:29Z")

</div>

Hello. I'm doing the following query to search some itens:

```
{
  "filtered" : {
    "query" : {
      "match" : {
        "name_db" : {
          "query" : "Human",
          "type" : "boolean"
        }
      }
    },
    "filter" : {
      "terms" : {
        "cat" : ["B8E"],
        "execution" : "bool"
      }
    }
  }
}

```

See that "cat" field? When it's something like "B8E" there are no results (even though it should), while when it's something like "320" the results are correct. What could be wrong? Why mixing letters and number would be a problem?

EDIT: It's not only when mixing letters and numbers, there are also no results and "cat" has only letters. For instance: BFD. It only works when cat is only numbers.

Thanks in advance.

PS: I'm new to elasticsearch

---

<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:** [January 4, 2016, 9:06pm UTC](https://discuss.elastic.co/t/problem-with-filter-when-term-is-with-letters-and-numbers/38340/2 "2016-01-04T21:06:56Z")

</div>

The field was probably a number field or analyzed as a string field. Verify  
using the mapping API that the "cat" field is a string and not\_analyzed (or  
at least uses a keyword tokenizer). If you use dynamic mappings and the  
first indexed document had pure numbers for "cat", it will map as a  
numerical field.

---

<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:27pm UTC](https://discuss.elastic.co/t/problem-with-filter-when-term-is-with-letters-and-numbers/38340/3 "2017-07-05T23:27:15Z")

</div>


