# Issue with query\_string query

**URL:** <https://discuss.elastic.co/t/issue-with-query-string-query/268889>\
**Category:** Elasticsearch\
**Created:** [March 31, 2021, 9:28am UTC](https://discuss.elastic.co/t/issue-with-query-string-query/268889 "2021-03-31T09:28:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![arthur\_th](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@arthur\_th](https://discuss.elastic.co/u/arthur_th)\
**Post date:** [March 31, 2021, 9:28am UTC](https://discuss.elastic.co/t/issue-with-query-string-query/268889/1 "2021-03-31T09:28:17Z")

</div>

Hello,

I am new to the Elastic stack, I want to do a specific search and it doesn't seem to work.

**I want to search for a regex respecting word order.**

For example this would be a query with query\_string: `'(/Cytochrome[s]? P[-/]?450/)'`  
(Parameters are 'default\_operator' : 'AND' and 'analyzer': 'keyword')

But this won't work because of the whitespace.

To make it work I have to change it like that `(/Cytochrome[s]?/ /P[-/]?450/)` but this will search for the 2 terms to be present in my text and not as a single term.

The only way I found to preserve word order is to add `""` to the terms like that `'"(Cytochrome P450)"'` but I am unable to use regex and the quotes is the same query...

=\> `"the protein Cytochromes P450 blabla" ` is correct and must match  
=\> `"Cytochrome protein blabla, USP P-450 blabla" ` is not correct and must not match

Do you have a solution to make it work with my regex ?

Thanks for your replies.

---

<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:** [April 28, 2021, 9:29am UTC](https://discuss.elastic.co/t/issue-with-query-string-query/268889/2 "2021-04-28T09:29:06Z")

</div>

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