Multi Search with "AND" operation among them

We have a use case where we need to perform multiple query with AND operation between textbox and OR operation within textbox. Is there any way to achieve them in APP SEARCH?

we have 3 text box where user can enter multiple values in each of them and we have filter too like shown below :

areaOfInterest can be multiple like GI, Breast, .. and operation we need among those is "OR".
Protocol/IRB can be multiple too and same "OR" between them.

operation between textbox(areaOfInterest, Protocol/IRB) should be "AND"

Hi @pradeepjanga, sophisticated queries like the one you're describing may require some more complex syntax.

What you're describing can easily be obtained using a boolean query directly to Elasticsearch. If you're using app search a potential workaround could be to use the search explain API to see a typical app search query, then modify that to use a nested boolean query through the Elasticsearch passthrough API

You could also look at combining filters however that may not be sophisticated enough to meet your needs.

While our Query API syntax does support limited Lucene Query Syntax such as AND, OR and NOT I don't think it will necessarily meet your needs due to the sheer amount of structured data you'd pass in.

Thanks for your reply. i think we are still using older version which is 7.13 and don't have that feature yet.
Just curious if we have something like below one word "Radation Oncology", how to search that as a single word ?

{
  "query" : "Radiation Oncology",
 "search_fields": {
        "disease_groups": {},
        "department": {}
    },
    "page": {
        "size": 1000
    }
}

@pradeepjanga If you want to do a text search, you can use a match phrase query to match the phrase "Radiation Oncology." Alternately if this is in a keyword field you could filter on that.

App search doesn't allow us to use match phrase query

If you can't upgrade to use Elasticsearch passthrough queries using quoted Strings or filters may work for your needs.

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