【发布时间】:2022-10-13 17:09:23
【问题描述】:
我是弹性搜索的新手
所以我试图创建一个具有特定“doc_type”的文档,但是当我传入 doc_type 参数时,我收到了这个错误:
elasticsearch.exceptions.RequestError: RequestError(400, '没有找到 uri [/employees/teacher/1] 和方法 [PUT] 的处理程序', '没有找到 uri [/employees/teacher/1] 和方法 [PUT] 的处理程序] ')
有谁知道出了什么问题?
我的代码:
es = Elasticsearch(
["localhost"],
port=9200,
connection_class=RequestsHttpConnection,
http_auth=("elastic", "elastic"),
use_ssl=True,
verify_certs=False
)
body = {
'name': 'John',
'age': 21
}
# es.indices.create(index = 'employees')
# This line works fine
es.index(index='employees', id = 1, body = body, refresh = 'true' )
# This line caused the error
es.index(index='employees', doc_type='teacher', id = 1, body = body )
【问题讨论】:
标签: python elasticsearch