If you run:
POST _analyze
{
"text" : "HKCR\\mscfile\\shell\\open\\command\\(Default)"
}
you will see how Elasticsearch tokenizes the string:
{
"tokens" : [
{
"token" : "hkcr",
"start_offset" : 0,
"end_offset" : 4,
"type" : "<ALPHANUM>",
"position" : 0
},
{
"token" : "mscfile",
"start_offset" : 5,
"end_offset" : 12,
"type" : "<ALPHANUM>",
"position" : 1
},
{
"token" : "shell",
"start_offset" : 13,
"end_offset" : 18,
"type" : "<ALPHANUM>",
"position" : 2
},
{
"token" : "open",
"start_offset" : 19,
"end_offset" : 23,
"type" : "<ALPHANUM>",
"position" : 3
},
{
"token" : "command",
"start_offset" : 24,
"end_offset" : 31,
"type" : "<ALPHANUM>",
"position" : 4
},
{
"token" : "default",
"start_offset" : 33,
"end_offset" : 40,
"type" : "<ALPHANUM>",
"position" : 5
}
]
}
My guess is it has to do with how regular expressions work with those tokens, if you AND
two separate queries like that it fetches your document:
GET _search
{
"query": {
"query_string": {
"query": "(registry_key_path:/.*mscfile.*/) AND (registry_key_path:/.*shell.*/)"
}
}
}
I realize it does solve your questions, but maybe it helps, and maybe somebody from Elasticsearch can chime in here.