.keyword
sub field is generated at index time behind the scene by Elasticsearch with the default mapping. It creates a .keyword
sub field which has the type keyword
. Which means that it is indexed exactly as it has been provided = no transformation.
If you search within this field, indeed only exact matches will work.
Is it possible to force an exact match using a substring?
Not sure. May be with match phrase query but on a text field. It should guarantee at least the positions of the tokens if this is what you are after.
But your example seems theorical, right? May be share a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.