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

Error occurs in ElasticSearch.connection.perform_request #162

@pjongy

Description

@pjongy

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions