# Search using regular expression in Kibana

**URL:** <https://discuss.elastic.co/t/search-using-regular-expression-in-kibana/65888>\
**Category:** Kibana\
**Created:** [November 12, 2016, 7:42pm UTC](https://discuss.elastic.co/t/search-using-regular-expression-in-kibana/65888 "2016-11-12T19:42:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![krishna\_chaitanya](https://avatars.discourse-cdn.com/v4/letter/k/b5a626/32.png) [@krishna\_chaitanya](https://discuss.elastic.co/u/krishna_chaitanya)\
**Post date:** [November 12, 2016, 7:42pm UTC](https://discuss.elastic.co/t/search-using-regular-expression-in-kibana/65888/1 "2016-11-12T19:42:46Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![krishna\_chaitanya](https://avatars.discourse-cdn.com/v4/letter/k/b5a626/32.png) [@krishna\_chaitanya](https://discuss.elastic.co/u/krishna_chaitanya)\
**Post date:** [November 13, 2016, 3:56pm UTC](https://discuss.elastic.co/t/search-using-regular-expression-in-kibana/65888/2 "2016-11-13T15:56:45Z")

</div>

I got an answer for this. "lowercase\_expanded\_terms" must be set to **false** in Kibana advanced settings.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 11, 2016, 3:57pm UTC](https://discuss.elastic.co/t/search-using-regular-expression-in-kibana/65888/3 "2016-12-11T15:57:05Z")

</div>

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