Re: multi-term multi-field search


(Shay Banon) #1

You can combine a text query on each field, and wrap it in a bool query
placing all teh relevant text queries as should clauses.

On Tue, Mar 20, 2012 at 4:59 PM, Giorgio Salluzzo <
giorgio.salluzzo@gmail.com> wrote:

Hi there,
in my company we are trying to port all our search platform to
ElasticSearch. I can't understand how to perform a query to obtain
something as follows:

  • title, subject and body are some fields of my documents;
  • 'a', 'b', 'c', 'd' are the words in my query string;
  • the result should match all the following:
    • title = "... b ... a ... c ... d ..."; // all words in a field
    • title = "... b ... a ... d ..." , subject = "... a ..." , body =
      "... a ... c ..."; // all words found in one or more field
    • title = " .... " , subject = " ... a ... c ..." , body =" ...
      b ... d ...".

If one word -or more- is not in at least one field the resultset
should be empty.

Thanks in advance.

Regards,
Giorgio


(system) #2