我的查詢很簡單 - 將欄位:值添加到現有檔案,但由于 document_missing_exception 錯誤而失敗。下面的代碼沒有引數,以便于查看我使用 opensearch py 客戶端并將索引、co_type 設定為該索引、檔案的 id 和查詢正文,如上一篇文章如何使用 elasticsearch-py 更新檔案?
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)
仍然,錯誤是
"errorMessage": "NotFoundError(404, 'document_missing_exception', '[movies][thematrix]: document missing')",
"errorType": "NotFoundError"
GET 查詢中的專案-
"hits" : [
{
"_index" : "movies",
"_type" : "_doc",
"_id" : "thematrix",
"_score" : 1.0,
"_source" : {
.....
并通過客戶——
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'}}]}}
缺什么?
uj5u.com熱心網友回復:
您使用的 Elasticsearch 版本是什么?
請嘗試給予
"doc_type" as "_doc".
如果您使用的是 ES 版本 7.0,請嘗試洗掉 doc_type
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/428934.html
標籤:Python python-3.x 弹性搜索 开放搜索 弹性搜索-py
