Create a query based on given input


(Euan) #1

Hey all

I am rather new to Elasticsearch, only been using is for the last 3 days on and off. I was wondering is there a way that I can create a search query, based on the input given?

I have 2 input fields, phrase and status, with 3 possible combinations for them

  1. Phrase and status are given
  2. A phrase and no status is given
  3. No phrase and a status given.

Is there any way that I can create a single query to handle this rather than have 3 separate queries for each scenario?

Regards


(David Pilato) #2

Use a bool query with 3 should clauses inside and that should answer to your needs.


(system) #3

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