Regexp not working in nested query

{
"query": {
"bool": {
"must": [
{
"match": {
"testCase.status": "PASS"
}
},
{
"nested": {
"path": "testCase.logs",
"query": {
"regexp": {
"testCase.logs.message": {
"value": "W.*R"
}
}
}
}
}

      ]
   }

}
}
i am searching for word WETR
but using this query i am getting no match found

but manually when i tried finding the word its there.
can you solve this bug?

Hi @Ankit_Anuj

Welcome to our community!

Could you provide a sample document (removing any sensitive data) that should match your query?
Also could you format your message so we can better see the request you are sending?

I guess that in your mappings you have testCase.status as keyword and testCase.logs as nested field, is that correct?

Thank you
Sébastien

the mapping is very huge.


and yes you are correct testCase.Status type is "text" and testCase.logs is "Nested" and testCase.logs.message is type "text"

"message": "WETR*2<<",
my query should match this but it is not maching

logs:

type:

nested

properties:

:arrow_forward:

logger_name:

message:

type:

text
hope this helps
and please let me know how i can solve this?
its very urgent for me
actually Elastic is tokenizing my log file and that's why this query is not working.
so please help me by telling the query which can solve this

Hi,

It is very difficult to follow if you don't format the code using the code block.

It seems that the string you want to match is WETR*2<< is that correct?

In that case the regex needs to be W.*< and not W.*R

Thanks
Sébastien

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.