Skip to content

Commit c855adc

Browse files
committed
None for parameter value should cause that param to be ignored
Fixes elastic#375
1 parent 10c013a commit c855adc

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Changelog
99
Version compatible with elasticsearch 5.0
1010

1111
* added ``headers`` arg to connections to support custom http headers
12+
* passing in a keyword parameter with ``None`` as value will cause that param
13+
to be ignored
1214

1315
2.3.0 (2016-02-29)
1416
------------------

elasticsearch/client/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def _escape(value):
3333
except UnicodeDecodeError:
3434
# Python 2 and str, no need to re-encode
3535
pass
36-
36+
3737
return str(value)
3838

3939
def _make_path(*parts):
@@ -60,7 +60,9 @@ def _wrapped(*args, **kwargs):
6060
params = kwargs.pop('params', {})
6161
for p in es_query_params + GLOBAL_PARAMS:
6262
if p in kwargs:
63-
params[p] = _escape(kwargs.pop(p))
63+
v = kwargs.pop(p)
64+
if v is not None:
65+
params[p] = _escape(v)
6466

6567
# don't treat ignore and request_timeout as other params to avoid escaping
6668
for p in ('ignore', 'request_timeout'):

0 commit comments

Comments
 (0)