ElasticHttpError:406,索引数据时出现弹性搜索错误 [英] ElasticHttpError: 406, Elastic Search Error While indexing Data

查看:182
本文介绍了ElasticHttpError:406,索引数据时出现弹性搜索错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在弹性搜索中为数据建立索引.

I am trying to index data in elastic search.

以下是有关弹性搜索的版本和其他详细信息

following is the version and other details about elastic search

{ "name" : "Tmqcj9W",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "HvwGfRrpR4-iaViCTm9ZwA",
  "version" : {
    "number" : "6.1.1",
    "build_hash" : "bd92e7f",
    "build_date" : "2017-12-17T20:23:25.338Z",
    "build_snapshot" : false,
    "lucene_version" : "7.1.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0",
   }"tagline" : "You Know, for Search"}

用于索引数据的客户端代码在python中:

The client side code to index data is in python:

es = ElasticSearch('http://localhost:9200/')
es.create_index(index_name)
es.bulk_index("index_name", "doc_type", [{"title":"this is title","desc":"this is description"}])

我遇到以下错误.

"pyelasticsearch.exceptions.ElasticHttpError:(406,'不支持Content-Type标头[]')""

经过几次搜索后,我收到一些建议,说我需要将内容类型设置为"application/json" ,但是我不确定如何设置它. 有人可以帮我吗?.

After few searches I got few suggestions saying I need to set the content type to "application/json", but I am not sure how to set this. Can anyone help me with this ?.

推荐答案

问题与elasticsearch python库有关.我将版本降级为6. sudo pip3 install elasticsearch == 6.0.0

Issue was with elasticsearch python library. I downgraded the version to 6. sudo pip3 install elasticsearch==6.0.0

这篇关于ElasticHttpError:406,索引数据时出现弹性搜索错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆