Please help me understand the Bool query

These are essentially two questions:

  1. How does the should part of a Bool filter influence the results
    returned?
    Could one say that where must creates an AND combination of filters,
    should creates an OR?

  2. I have used the Bool filter in something that I now realize, makes little
    sense. However, also don't understand its behavior:
    Given I have documents in my index which can have either value of /en/, /de/
    or /fr/ for the field locale, the following filter returns results with
    the locale being either /en/ or /fr/:

Here's the result (example data):

The same result is being returned if I set locale to be /fr/.

If I use /de/ for the locale field in should, I get

/Question is:/ Why does the filter with should -> locale -> en/fr even show
results where the should condition isn't met?

Best regards,
David

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/Please-help-me-understand-the-Bool-query-tp4036264.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

  1. Basically, should helps to increase scoring. So if two documents match the same must clause and one of them only match the should clause, this last document will be more relevant and will get an higher score.

If you have a must query and some should clauses, should clauses does not have to match unless you set minimum_number_should_match > 0.
If you don't have any must or must_not clause, then at least one of the should clauses must be satisfied.

  1. I don't fully follow you here. Could you illustrate and gist a full curl recreation?

Does it help?

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 8 juin 2013 à 21:11, kwisarts draison@gmail.com a écrit :

These are essentially two questions:

  1. How does the should part of a Bool filter influence the results
    returned?
    Could one say that where must creates an AND combination of filters,
    should creates an OR?

  2. I have used the Bool filter in something that I now realize, makes little
    sense. However, also don't understand its behavior:
    Given I have documents in my index which can have either value of /en/, /de/
    or /fr/ for the field locale, the following filter returns results with
    the locale being either /en/ or /fr/:

Here's the result (example data):

The same result is being returned if I set locale to be /fr/.

If I use /de/ for the locale field in should, I get

/Question is:/ Why does the filter with should -> locale -> en/fr even show
results where the should condition isn't met?

Best regards,
David

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/Please-help-me-understand-the-Bool-query-tp4036264.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.