Home > Blockchain >  "document_missing_exception" at Opensearch client.update (python)
"document_missing_exception" at Opensearch client.update (python)

Time:02-19

My query is simple - add field:value to existing doc, but it fails with error of document_missing_exception. the code below is without parameters to make it easy to view i use opensearch py client and set the index,co_type as that indx, id of the document and query body, as seen in previous post How to update a document using 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)

still, the error is

"errorMessage": "NotFoundError(404, 'document_missing_exception', '[movies][thematrix]: document missing')",
  "errorType": "NotFoundError"

the items in GET query-

"hits" : [
  {
    "_index" : "movies",
    "_type" : "_doc",
    "_id" : "thematrix",
    "_score" : 1.0,
    "_source" : {
           .....

and through the client-

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'}}]}}

what is missing?

CodePudding user response:

What is the Elasticsearch version you are using?

Please try by giving

"doc_type" as "_doc".

If you are using ES version 7.0 then try by removing doc_type

  • Related