Search using regular expression in Kibana

I am newbie to ELK. I want to search for docs based on order of occurrence of words in a field. For example,

In doc1, my_field: "MY FOO BAR EXAMPLE"
In doc2, my_field: "MY BAR FOO EXAMPLE"

I would like to query in Kibana for docs where "FOO" is followed by "BAR" and not the opposite. So, I would like doc1 to return in this case and not doc2.
I tried using below query in Kibana search. But, it is not working. This query doesn't even produce any search results.

my_field.raw:/.*FOO.*BAR.*/

I also tried with analyzed field, though I came to know that should not work. And of course, that didn't produce any results either.

Please help me with this regex search. Why am I not getting any result for that query?

I got an answer for this. "lowercase_expanded_terms" must be set to false in Kibana advanced settings.

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