0

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?

2
  • Do you have doc with ID thematrix in the index? Commented Feb 16, 2022 at 19:12
  • yes i have, i've added now to the question main, thanks for pointing Commented Feb 16, 2022 at 19:22

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

1 Comment

thanks, its AWS opensearch 1.0 (based on 7.10) so your suggestion was good and solved it!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.