Count for fieldName & fieldName.keyword different

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"
    }
  }
}

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.

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.

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