How does Elasticsearch store a float value into an keyword field

50 views Asked by At

I have created this index:

{
  "users" : {
    "mappings" : {
      "properties" : {
        "user_id" : {
          "type" : "keyword"
        }
      }
    }
  }
}

and I added this entry:

PUT users/_doc/1
{
  "user_id": 4.0000
}

When I query like this, I always can get this entry

GET /_search
{
  "query": {
    "term": {
      "user_id": {
        "value": 4.0, // not exact same value as I put in
        "boost": 1.0
      }
    }
  }
}

I wonder why this happens.

0

There are 0 answers