我正在尝试在弹性搜索中索引数据。
以下是有关弹性搜索的版本和其他详细信息
{ "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"}
Run Code Online (Sandbox Code Playgroud)
索引数据的客户端代码在 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"}])
Run Code Online (Sandbox Code Playgroud)
我收到以下错误。
“pyelasticsearch.exceptions.ElasticHttpError: (406, 'Content-Type header [] is not supported')”
经过几次搜索后,我得到了一些建议,说我需要将内容类型设置为"application/json",但我不确定如何设置。谁能帮我这个 ?。