Cannot match special characters in regular in ES 7.x

Trying to use regexp matching a value like xxx.php,i write the following code.And I also found many ways for me to escape with double backslashes, but it doesn't work either.I guess it should be a version issue.

GET /log.XXXX/_search
{
    "query": {
        "regexp": {
            "uri_path": "@(\\.php)"
        }
    }
}

Of course, the following code can match the result I want, but I think that @ matches the special character .

GET /log.XXXX/_search
{
    "query": {
        "regexp": {
            "uri_path": "@(php)"
        }
    }
}

So sincerely hope to get your suggestions

Hey

can you share the mapping for this field and provide a fully fledged example? I suppose your field is already analyzed & tokenized and there this approach does not work. Have you tried to just search for php as well?

thx,i got it.I can’t match because of the word segmentation, just change to the keyword type, which is uri_path.keyword

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