Hello there, I am looking a weird behavior on one of my query, see if you can help.
I am indexing the following 2 documents
PUT ramptestindex/_doc/360238
{
"OriginRamp" : {
"RampID" : 360238,
"RampCode" : "D!",
"RampName" : "Kansas City Southern Ramp"
}
}
PUT ramptestindex/_doc/360237
{
"OriginRamp" : {
"RampID" : 360237,
"RampCode" : "D#",
"RampName" : "Kansas City Southern Ramp"
}
}
And my query is
GET ramptestindex/_search
{
"query": {
"query_string": {
"query": "D#*",
"analyze_wildcard" : true,
"default_operator": "AND",
"fields": [
"OriginRamp.RampCode.keyword"
]
}
}
}
If my search is "D#" it pulls up the doc but when its "D!" it doesn't. It works if I used "simple_query_string" instead of a "query_string" but I will be wildcarding on both ends of the search query that is not supported in simple_query_string.
My search is on the keyword field so I am assuming analyzers are not an issue.
I did a profile to see whats going on and the search with D! uses a BooleanQuery
{
"type" : "BooleanQuery",
"description" : "+OriginRamp.RampCode.keyword:D -ConstantScore(DocValuesFieldExistsQuery [field=OriginRamp.RampCode.keyword])"
and the search with D# uses a TermQuery
"query" : [
{
"type" : "MultiTermQueryConstantScoreWrapper",
"description" : "OriginRamp.RampCode.keyword:D#*",