diff --git a/Changelog.rst b/Changelog.rst index 952df062..183d5eb4 100644 --- a/Changelog.rst +++ b/Changelog.rst @@ -9,6 +9,8 @@ Changelog Version compatible with elasticsearch 5.0 * added ``headers`` arg to connections to support custom http headers + * passing in a keyword parameter with ``None`` as value will cause that param + to be ignored 2.3.0 (2016-02-29) ------------------ diff --git a/elasticsearch/client/utils.py b/elasticsearch/client/utils.py index 7a015a6b..2327d823 100644 --- a/elasticsearch/client/utils.py +++ b/elasticsearch/client/utils.py @@ -33,7 +33,7 @@ def _escape(value): except UnicodeDecodeError: # Python 2 and str, no need to re-encode pass - + return str(value) def _make_path(*parts): @@ -60,7 +60,9 @@ def query_params(*es_query_params): params = kwargs.pop('params', {}) for p in es_query_params + GLOBAL_PARAMS: if p in kwargs: - params[p] = _escape(kwargs.pop(p)) + v = kwargs.pop(p) + if v is not None: + params[p] = _escape(v) # don't treat ignore and request_timeout as other params to avoid escaping for p in ('ignore', 'request_timeout'):