Elasticsearch Python http_compress = True导致'json_parse_exception','非法字符((CTRL-CHAR,代码31)

时间:2020-06-05 09:40:05

标签: python-3.x elasticsearch

环境

MacOS 10.10.4
Python 3.7 -elasticsearch == 7.7.1
-requests-aws4auth == 0.9

问题

es = elasticsearch.Elasticsearch(
    hosts=[
        ES_ENDPOINT
    ],
    http_auth=awsauth,
    use_ssl=True,
    verify_certs=True,
    ssl_show_warn=True,
    connection_class=elasticsearch.RequestsHttpConnection,
    http_compress = True <--- This line causes the error.
)

错误

elasticsearch.exceptions.TransportError: TransportError(500, 'json_parse_exception', 'Illegal character ((CTRL-CHAR, code 31)): only regular white space (\\r, \\n, \\t) is allowed between tokens\n at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@39998a59; line: 1, column: 2]')
  File "/Users/python/venv/lib/python3.7/site-packages/elasticsearch/helpers/actions.py", line 240, in streaming_bulk
    **kwargs
  File "/Users/python/venv/lib/python3.7/site-packages/elasticsearch/helpers/actions.py", line 126, in _process_bulk_chunk
    raise e
  File "/Users/python/venv/lib/python3.7/site-packages/elasticsearch/helpers/actions.py", line 122, in _process_bulk_chunk
    resp = client.bulk("\n".join(bulk_actions) + "\n", *args, **kwargs)
  File "/Users/python/venv/lib/python3.7/site-packages/elasticsearch/client/utils.py", line 92, in _wrapped
    return func(*args, params=params, headers=headers, **kwargs)
  File "/Users/python/venv/lib/python3.7/site-packages/elasticsearch/client/__init__.py", line 462, in bulk
    body=body,
  File "/Users/python/venv/lib/python3.7/site-packages/elasticsearch/transport.py", line 362, in perform_request
    timeout=timeout,
  File "/Users/python/venv/lib/python3.7/site-packages/elasticsearch/connection/http_requests.py", line 179, in perform_request
    self._raise_error(response.status_code, raw_data)
  File "/Users/python/venv/lib/python3.7/site-packages/elasticsearch/connection/base.py", line 282, in _raise_error
    status_code, error_message, additional_info
elasticsearch.exceptions.TransportError: TransportError(500, 'json_parse_exception', 'Illegal character ((CTRL-CHAR, code 31)): only regular white space (\\r, \\n, \\t) is allowed between tokens\n at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@39998a59; line: 1, column: 2]')

0 个答案:

没有答案
相关问题