首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Opensearch client.update (python)上的"document_missing_exception“

Opensearch client.update (python)上的"document_missing_exception“
EN

Stack Overflow用户
提问于 2022-02-16 15:47:43
回答 1查看 639关注 0票数 0

我的查询很简单-向现有文档添加字段:value,但由于document_missing_exception错误而失败。下面的代码没有参数以便于查看,我使用opensearch py客户机并设置索引,co_type作为文档和查询主体的indx、id,如前面的How to update a document using elasticsearch-py?文章所示。

代码语言:javascript
运行
复制
 query = {
            'doc': {
               "description_es": "Cuando una bella desconocida lleva al hacker inform\\u00e1tico Neo a un inframundo imponente, descubre la "
                    }
                }
        print("query:::   ",query)
        response= hostClient.update(index="movies", doc_type='movies',id= "thematrix", body=query)

尽管如此,错误是

代码语言:javascript
运行
复制
"errorMessage": "NotFoundError(404, 'document_missing_exception', '[movies][thematrix]: document missing')",
  "errorType": "NotFoundError"

GET查询中的项目-

代码语言:javascript
运行
复制
"hits" : [
  {
    "_index" : "movies",
    "_type" : "_doc",
    "_id" : "thematrix",
    "_score" : 1.0,
    "_source" : {
           .....

通过客户-

代码语言:javascript
运行
复制
search results:: {'took': 10, 'timed_out': False, '_shards': {'total': 5, 'successful': 5, 'skipped': 0, 'failed': 0}, 'hits': {'total': {'value': 1, 'relation': 'eq'}, 'max_score': 0.5753642, 'hits': [{'_index': 'movies', '_type': '_doc', '_id': 'thematrix', '_score': 0.5753642, '_source': {'title': 'The Matrix', 'type': 'movie', 'listed_in': 'Action,Adventure,Sci-Fi,Thriller', 'description': 'When a beautiful stranger leads computer hacker Neo to a forbidding underworld, he discovers the shocking truth--the life he knows is the elaborate deception of an evil cyber-intelligence.', 'director': 'The Wachowski Brothers', 'release_year': 1999, 'cast': 'Keanu Reeves,Laurence Fishburne,Carrie-Anne Moss', 'country': 'United States', 'rating': 'PG-13', 'duration': '102 min', 'image_url': 'https://static.wikia.nocookie.net/matrix/images/5/56/The_Matrix_digital_release_cover.jpg/revision/latest/scale-to-width-down/1000?cb=20210908111245'}}]}}

少了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-02-17 12:03:09

您正在使用的Elasticsearch版本是什么?

请试着给予

代码语言:javascript
运行
复制
"doc_type" as "_doc".

如果您正在使用ES version 7.0,那么通过删除doc_type尝试

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71144961

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档