diff --git a/elasticsearch/connection/base.py b/elasticsearch/connection/base.py index 62d62f65c..3ea18fd57 100644 --- a/elasticsearch/connection/base.py +++ b/elasticsearch/connection/base.py @@ -76,7 +76,7 @@ def log_request_success(self, method, full_url, path, body, status_code, respons # body has already been serialized to utf-8, deserialize it for logging # TODO: find a better way to avoid (de)encoding the body back and forth if body: - body = body.decode('utf-8') + body = body.decode('utf-8', 'ignore') logger.info( '%s %s [status:%s request:%.3fs]', method, full_url, @@ -100,7 +100,7 @@ def log_request_fail(self, method, full_url, path, body, duration, status_code=N # body has already been serialized to utf-8, deserialize it for logging # TODO: find a better way to avoid (de)encoding the body back and forth if body: - body = body.decode('utf-8') + body = body.decode('utf-8', 'ignore') logger.debug('> %s', body)