Search Operators


#1

I trying to achieve behavior similar to using Google search operators. For instance, Google supports "AND", and "OR" operators as part of query string, in order to produce more refined searches. For example:

"Junior AND Developers" --> will return results which include both terms (junior and developer/s)

"Junior OR Developers) -->will return results which include any of provided terms (junior or developer/s)

Or, in Google, term provided in quotes searched "as-is" (e.g. exact match).

Is there similar functionality in Elasticsearch? What is default behavior in Elasticsearch? (e.g. what exactly happens when I search for "Junior Developers" (e.g. white-space between terms)?


(Mark Walkom) #2

Check out https://www.elastic.co/guide/en/elasticsearch/guide/2.x/search.html, it's still valid for 5.X.


#3

I reviewed documentation, thank you.

So, if I understand correctly, it is my responsibility to parse user input and to build based on it ES query? Is there any built-in parser? It's not trivial at all to parse complex statements (e.g. combinations of "OR" and "AND" blocks).


(Mark Walkom) #4

If that is what your users are expecting, then yes.


#5

Actually I discovered that 'QueryString' does exactly what I need (e.g. parsing string expression).


(system) #6

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