没有找到 uri [<index>/_doc/<document_id>/_update] 和方法 [POST] 的处理程序

no handler found for uri [<index>/_doc/<document_id>/_update] and method [POST]

目前我使用的是客户端go-elasticsearch版本v7.8.0和elastic版本8.1.2。弹性搜索已从版本 7.x

更新

现在,当我尝试更新文档时失败并出现以下错误。

有一些像这样的 Whosebug 答案,但没有帮助

api_platform produces Error "no handler found for uri [/index/_doc/_search] and method [POST]"

elasticsearch response on failure while updating- {"error":"no handler found for uri [/<index>/_doc/<doc_id>/_update?retry_on_conflict=2] and method [POST]"

更新查询示例:

{"doc":{"info":{"description":"test description","slug":"test"}}}

您不能将 7.8.0 的 Go 客户端与 Elasticsearch 服务器 8.1.2 一起使用,它们不兼容。您需要将 Go 客户端升级到 same 8.1 version

请尝试改用端点 /{index}/_update/{id}。您使用的那个在 8.1 中已弃用并删除。

参考:

https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html#docs-update-api-request