【问题标题】:How to change the Content-Type in *aioes*如何更改 *aioes* 中的 Content-Type
【发布时间】:2019-07-20 05:35:45
【问题描述】:

我正在使用库 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())

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

我尝试过上网,但没有找到任何解决方案。我哪里错了?

【问题讨论】:

    标签: python elasticsearch content-type


    【解决方案1】:

    aioes 已经被废弃了,我认为它不支持 ES6.0 及更高版本,需要指定内容头。如果您查看 aioes github,他们现在推荐“官方”ES python 客户端。

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

    【讨论】:

      猜你喜欢
      • 2012-07-28
      • 2013-05-02
      • 1970-01-01
      • 2013-07-10
      • 1970-01-01
      • 2018-09-05
      • 2015-05-08
      • 1970-01-01
      • 2017-07-10
      相关资源
      最近更新 更多