Unknown mimetype unable to deserialize

Hi ,

I am just playing around with python elasticsearch module. But seems like i am unable to make it work. Right now i am just setting up the connection so no complex coding yet. Below is what i see:

Traceback (most recent call last):
  File "es.py", line 8, in <module>
    health = es.cluster.health()
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/utils.py", line 73, in _wrapped
    return func(*args, params=params, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/cluster.py", line 33, in health
    'health', index), params=params)
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/transport.py", line 342, in perform_request
    data = self.deserializer.loads(data, headers.get('content-type'))
  File "/usr/local/lib/python2.7/dist-packages/elasticsearch/serializer.py", line 74, in loads
    raise SerializationError('Unknown mimetype, unable to deserialize: %s' % mimetype)
elasticsearch.exceptions.SerializationError: Unknown mimetype, unable to deserialize: text/html

My Code:-

from elasticsearch import Elasticsearch

es = Elasticsearch([
    {'host': 'xxxxxxxxxxxxxxxxxxxxxxxx', 'port': 80, 'url_prefix': 'elasticsearch'}
    ])

health = es.cluster.health()

print health

Details:-

OS Version:- Ubuntu 14.04 LTS
Python version :- 2.7
Pip Versions:-

1. elasticsearch (5.5.1)  -- Have upgraded to 6.0.0 for trial
2. urllib3 (1.21.1)

--
Niraj

How have you installed Elasticsearch? It look like you are running Elasticsearch behind a proxy (with the proxy running on port 80 of your host). Is this correct? If so I think it is your proxy causing this error as Elasticsearch does not output text/html.

On the server I have installed it using the rpm and on my workstation using pip.

The elasticsearch is hosted on AWS while my workstation is behind a proxy. I do have http and https proxy set. Not sure if I need to explicitly specify proxy using os.environ... I am able to successfully curl from command line though. Let me know what do you suggest.

I think you probably will have to configure your proxy so the Elasticsearch python client knows to use it but I don't know enough about the python client to know how to do that. This old issue may help but I'm not sure: https://github.com/elastic/elasticsearch-py/issues/275

I tried setting up the proxy but it is still the same. :frowning:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.