Skip to content

__and__ operator fails for Bool with minimum_should_match in percentage #1451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mmoriniere opened this issue Nov 13, 2020 · 1 comment
Closed
Labels
Category: Bug Something isn't right

Comments

@mmoriniere
Copy link

Hello,

I ran into on an error when trying to chain two such queries :

MyDocument.search().query(
    Bool(filter=Term(disabled=False))
).query(
    Bool(should=[my_should_clauses], minimum_should_match="-10%")
)

(where MyDocument derives from the Document class of django_elasticsearch_dsl).

The error happens here, and there actually is a TODO three lines above suggesting that this problem is known and ought to be fixed.

Is there any plan to support such a feature ?

Note: I already found two workarounds to avoid this issue :

  1. Refactor my code to use just one query,
  2. Make the second query look like this Bool(filter=Bool(should=[my_should_clauses], minimum_should_match="-10%")).
@miguelgrinberg
Copy link
Collaborator

A more explicit error message is now shown, indicating that only positive integers are currently supported for minimum_should_match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Bug Something isn't right
Projects
None yet
Development

No branches or pull requests

3 participants