# Unknown mimetype unable to deserialize

**URL:** <https://discuss.elastic.co/t/unknown-mimetype-unable-to-deserialize/108820>\
**Category:** Elasticsearch\
**Created:** [November 23, 2017, 5:21am UTC](https://discuss.elastic.co/t/unknown-mimetype-unable-to-deserialize/108820 "2017-11-23T05:21:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![niraj\_kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/niraj_kumar/32/4130_2.png) [@niraj\_kumar](https://discuss.elastic.co/u/niraj_kumar)\
**Post date:** [November 23, 2017, 5:21am UTC](https://discuss.elastic.co/t/unknown-mimetype-unable-to-deserialize/108820/1 "2017-11-23T05:21:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [November 23, 2017, 9:58am UTC](https://discuss.elastic.co/t/unknown-mimetype-unable-to-deserialize/108820/2 "2017-11-23T09:58:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![niraj\_kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/niraj_kumar/32/4130_2.png) [@niraj\_kumar](https://discuss.elastic.co/u/niraj_kumar)\
**Post date:** [November 23, 2017, 10:33am UTC](https://discuss.elastic.co/t/unknown-mimetype-unable-to-deserialize/108820/3 "2017-11-23T10:33:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [November 23, 2017, 1:38pm UTC](https://discuss.elastic.co/t/unknown-mimetype-unable-to-deserialize/108820/4 "2017-11-23T13:38:15Z")

</div>

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](https://github.com/elastic/elasticsearch-py/issues/275)

---

<div class="post-metadata">

**Author:** ![niraj\_kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/niraj_kumar/32/4130_2.png) [@niraj\_kumar](https://discuss.elastic.co/u/niraj_kumar)\
**Post date:** [November 28, 2017, 7:12am UTC](https://discuss.elastic.co/t/unknown-mimetype-unable-to-deserialize/108820/5 "2017-11-28T07:12:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 26, 2017, 7:12am UTC](https://discuss.elastic.co/t/unknown-mimetype-unable-to-deserialize/108820/6 "2017-12-26T07:12:41Z")

</div>

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