Skip to content
This repository has been archived by the owner on Nov 7, 2021. It is now read-only.

Error occurs in ElasticSearch.connection.perform_request #162

Open
pjongy opened this issue Apr 29, 2019 · 0 comments
Open

Error occurs in ElasticSearch.connection.perform_request #162

pjongy opened this issue Apr 29, 2019 · 0 comments

Comments

@pjongy
Copy link

pjongy commented Apr 29, 2019

File "/home/dev/.local/lib/python3.6/site-packages/aioes/connection.py", line 52, in perform_request
raise exc_class(resp.status, resp_body, extra)
aioes.exception.TransportError: TransportError(406, '{"error":"Content-Type header [application/octet-stream] is not supported","status":406}')

With test this code:

import asyncio
 from aioes import Elasticsearch
 async def go():
     es = Elasticsearch(['localhost:9200'])
     ret = await es.create(index="users",
                                doc_type="id",
                                id=42,
                                body={"str": "data", "int": 1})
     assert (ret == {'_id': '32',
                     '_index': 'users',
                     '_type': 'id',
                     '_version': 1})
     answer = await es.get(index="users",
                                doc_type="id",
                                id=42)
     assert answer['_source'] == {'str': 'data', 'int': 1}
 loop = asyncio.get_event_loop()
 loop.run_until_complete(go())

I think should contains
connection.py

 43         headers = {"Content-type":"application/json"}
 44         resp = yield from self._session.request(
 45             method, url, params=params, data=body, headers=headers)
pjongy added a commit to pjongy/aioes that referenced this issue Apr 29, 2019
Error occurs in ElasticSearch.connection.perform_request aio-libs-abandoned#162
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant