Default OR Search- do you override?

Elastic Search uses OR by default and other search engines, like Google and MS, use AND for default.
Training uses to reverse their logic for ES is challenging.
Does anyone override the OR and use AND?
I'm not a search expert but an end user trainer of this tool and am wondering how to make this easier for our support engineers to use (based on what is commonly used today in other apps).
Thanks!

Hey,

depending on the query you are using you can change the default operator/operator to AND, so that the search clause like foo bar will become foo AND bar. See https://www.elastic.co/guide/en/elasticsearch/reference/7.3/query-dsl-query-string-query.html and https://www.elastic.co/guide/en/elasticsearch/reference/7.3/query-dsl-match-query.html

hope this helps (unless your users are creating the whole query).

--Alex

Alex,

Thank you so much. The support engineers are entering text to search for content without our organization to help solve cases through the ES API within our CRM tool. We just came from SharePoint search which would take 2 words like (APM upgrade and send APM AND upgrade vs APM OR upgrade now in ES).

The engineers asked if we could override the default OR to make it act like an AND without having to use the ES operators; and I believe we don't want to do that; but just wanted to make sure that is correct. We have to learn how to use the new engine, not customize it. Can you verify that?

It's been a hard sell with engineers as even Google is a default AND. Could you help me in understanding the benefit of WHY Elastic Search is a default OR search?

Thanks so much!

Christie

please take another look at the links above. depending on what query you are using, you can configure this for each query. I assume that the people searching for infos are only putting a search string like foo bar somewhere, but you are constructing a query out of that using the elasticsearch query DSL. when doing that, there are parameter to change the behaviour we talked about earlier to always use AND when there is nothing specified.

I really want to thank you for this clarity and we will work on updating our match operator to AND.

1 Like