Search code examples
pythonloggingunicodepython-unicodeelasticsearch-py

How to logging unicode dictionary from elasticsearch-py?


By default, elasticsearch-py logs output dictionary as json dumped like:

{'key': '2016\u5e747\u670829\u65e5'}

While I'd like to see the result as following:

{'key': '2016年7月29日'}

How can I do that?

EDIT

Python 2.7.10

$ pip freeze | grep elasticsearch
elasticsearch==1.9.0

Solution

  • elasticsearch-py package has improved the unicode logging output.

    https://github.com/elastic/elasticsearch-py/commit/c305dc5587963bc9e41ae8cf35bb6eff5afb199e