# Count for fieldName & fieldName.keyword different

**URL:** <https://discuss.elastic.co/t/count-for-fieldname-fieldname-keyword-different/108017>\
**Category:** Elasticsearch\
**Created:** [November 16, 2017, 8:53pm UTC](https://discuss.elastic.co/t/count-for-fieldname-fieldname-keyword-different/108017 "2017-11-16T20:53:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![thampton](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@thampton](https://discuss.elastic.co/u/thampton)\
**Post date:** [November 16, 2017, 8:53pm UTC](https://discuss.elastic.co/t/count-for-fieldname-fieldname-keyword-different/108017/1 "2017-11-16T20:53:06Z")

</div>

I'm using Elasticsearch 5.2.2

Trying to understand why the following queries are returning different count for some fields, while returning the same count for others. I would expect to get the same count for each of them.

This query returns count of 1647 (this is correct).  
Query matches on the fields full text index.

```
GET my-index/_count
{
  "query": {
    "match": {
      "my_field_name": "value"
    }
  }
}

```

This second query return count of only 1  
Query matches on field's keyword index.

```
GET my-index/_count
{
  "query": {
    "match": {
      "my_field_name.keyword": "value"
    }
  }
}

```

This third query also returns count of only 1  
Query does an exact term match on the fields keyword index.

```
GET my-index/_count
{
  "query": {
    "term": {
      "my_field_name.keyword": "value"
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [November 17, 2017, 9:30am UTC](https://discuss.elastic.co/t/count-for-fieldname-fieldname-keyword-different/108017/2 "2017-11-17T09:30:40Z")

</div>

when using the `.keyword` field, the term you enter requires to be an exact match, because no analysis happens, the first example however just requires the term to be some where in the document.

---

<div class="post-metadata">

**Author:** ![thampton](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@thampton](https://discuss.elastic.co/u/thampton)\
**Post date:** [November 17, 2017, 1:40pm UTC](https://discuss.elastic.co/t/count-for-fieldname-fieldname-keyword-different/108017/3 "2017-11-17T13:40:28Z")

</div>

I'll double check my data, but I'm confident the value of the single field i'm searching on is an exact match for the query term. This is why I was surprised to see the counts differ.

Is the match query including partial matches? That wold explain it.

---

<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 15, 2017, 1:40pm UTC](https://discuss.elastic.co/t/count-for-fieldname-fieldname-keyword-different/108017/4 "2017-12-15T13:40:41Z")

</div>

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