According to the documentation, when doing a regex search in opensearch, the regex is applied to the individual tokens in the field, not the entire field.
Because of this, a query like
{
"query": {
"regexp": {
"myfield": ".+ABC.+"
}
}
}
does not return any results when the term “ABC” is preceeded by whitespace.
So for example, the field myfield
has a string that has spaces (and therefore separate terms):
The fields FIELD1 and FIELD2 are different: ABC4345 vs 2405987390
Searching for this exact message (with “matches”) will return it, but how, within the context of opensearch, could a query be written to find strings like .+are different.+ABC.+vs.+
or even just .+ABC.+
?