简体   繁体   English

如何在* aioes *中更改Content-Type

[英]How to change the Content-Type in *aioes*

I'm using the library aioes and when I try to execute this script: 我正在使用库aioes,并且在尝试执行此脚本时:

from aioes import Elasticsearch

import asyncio


@asyncio.coroutine
def check():
    host = 'localhost'
    port = 1234

    es = Elasticsearch(['{host}:{port}'.format(host=host, port=port)])

    answer = yield from es.search(index="test-index", body={})
    print(answer)


loop = asyncio.get_event_loop()
loop.run_until_complete(check())

I get this error: aioes.exception.TransportError: TransportError(406, '{"error":"Content-Type header [application/octet-stream] is not supported","status":406}') 我收到此错误: aioes.exception.TransportError: TransportError(406, '{"error":"Content-Type header [application/octet-stream] is not supported","status":406}')

I've tried to go through the Internet, but I haven't found any solution. 我曾尝试过Internet,但没有找到任何解决方案。 Where am I wrong? 我哪里错了?

aioes has been abandoned and I don't think it supports ES6.0 and above, which require the content header to be specified. aioes已被放弃,我认为它不支持ES6.0及更高版本,这要求指定内容标头。 If you check out the aioes github they recommend the 'official' ES python client now. 如果您查看aioes github,他们现在建议使用“官方” ES python客户端。

https://github.com/aio-libs-abandoned/aioes https://github.com/aio-libs-abandoned/aioes

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM