The reason behind this is because your field name is of type text.
Elasticsearch breaks the values when the data type is text. For instance, if you provide The Charlie or Charlie Puth, it will take the values like this [the, charlie] or [charlie, path] and it will be saved in the inverted index. So, right now if you query, it will return these documents which you consider to not match.
You can solve this by using lowercase normalizer. The mapping looks like this:
PUT <your_index_name>
{
"settings":{
"analysis":{
"normalizer":{
"my_custom_normalizer":{
"type":"custom",
"filter":[
"lowercase"
]
}
}
}
},
"mappings":{
"mydocs":{
"properties":{
"name":{
"type":"keyword",
"normalizer":"my_custom_normalizer"
}
}
}
}
}
Now, the data entered like The Charlie will be stored as the charlie and you stored in an inverted index. So, now you can query and get data as you expect.