Issue with query_string query


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.

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