None for parameter value should cause that param to be ignored

Fixes #375
This commit is contained in:
Honza Král
2016-08-16 20:46:04 +02:00
parent 10c013a067
commit c855adc6e6
2 changed files with 6 additions and 2 deletions
+2
View File
@@ -9,6 +9,8 @@ Changelog
Version compatible with elasticsearch 5.0 Version compatible with elasticsearch 5.0
* added ``headers`` arg to connections to support custom http headers * 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) 2.3.0 (2016-02-29)
------------------ ------------------
+3 -1
View File
@@ -60,7 +60,9 @@ def query_params(*es_query_params):
params = kwargs.pop('params', {}) params = kwargs.pop('params', {})
for p in es_query_params + GLOBAL_PARAMS: for p in es_query_params + GLOBAL_PARAMS:
if p in kwargs: 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 # don't treat ignore and request_timeout as other params to avoid escaping
for p in ('ignore', 'request_timeout'): for p in ('ignore', 'request_timeout'):