opensearch-project / opensearch-py

Python Client for OpenSearch
https://opensearch.org/docs/latest/clients/python/
Apache License 2.0
338 stars 170 forks source link

[BUG] `TypeError` error when using a `.filter(...)` on a `Search` object. #779

Closed Godefroy-Amaury closed 2 months ago

Godefroy-Amaury commented 2 months ago

What is the bug?

Get a TypeError error when using a .filter("terms", ...) on a Search object.

How can one reproduce the bug?

Having a str instead of an int for Bool.filter or Bool.must attributes when reach the Bool.__and__ method. This case can happen when using string based percent (eg: "50%") instead of pure integer (eg: 50) for minimum_should_match.

What is the expected behavior?

Accept 50, "50" or "50%" as valid values.

Do you have any additional context?

A TODO statement is present in the code for this specific case. This TODO statement date back at least from the opensearch-dsl 1.0.