1
'{"error":{"root_cause":[{"type":"invalid_type_name_exception","reason":"Document mapping type name can\'t start with \'_\', found: [_update]"}],"type":"invalid_type_name_exception","reason":"Document mapping type name can\'t start with \'_\', found: [_update]"},"status":400}',

Getting the above error as a response on making update request in elasticsearch while updating an index with elasticsearch, while below is the JSON data I'm passing.

 { name: 'TESTIN ONE (3)',
  id: 'PUZb8739273HD83DGE',
  titles:
   [ { id: 21, title: 'FALSELY ACCUSED' },
     { id: 21, title: 'FALSELY ACCUSED' },
     { id: 23, title: undefined } ] }

Also this the function I'm passing through

updateProjectIndex = async (project) => {
    try {
        const result = await client.update({
            index: "updatedproject",
            type: "_doc",
            id: project.id,
            refresh: 'true',
            body: project,
        });
        return result;
    }
    catch (e) {
        console.log(e);
    }
}

And in this function's parameter I'm passing above JSON.

Error

"error": {
      "root_cause": [
        {
          "type": "document_missing_exception",
          "reason": "[_doc][5d8de6a0806590a27895f971]: document missing",
          "index_uuid": "j26lRI1UTJuJmHw_GuPSxg",
          "shard": "0",
          "index": "docprojectnew"
        }
      ],
      "type": "document_missing_exception",
      "reason": "[_doc][5d8de6a0806590a27895f971]: document missing",
      "index_uuid": "j26lRI1UTJuJmHw_GuPSxg",
      "shard": "0",
      "index": "docprojectnew"
    },
    "status": 404   }

Value of project

{ projectName:
   'NEW UPDATE DATA (3)',
  id: '5d8de6a0806590a27895f971',
  titles:
   [ { id: 5d88afc8e9896c1ca7f2c065, title: 'FALSELY ACCUSED' },
     { id: 5d88afc8e9896c1ca7f2c065, title: 'FALSELY ACCUSED' },
     { id: 5d5eeb2ec300364d48764f78, title: undefined } ] }
5
  • type: "_doc" . Can you try doc instead of _doc and see if it works Commented Sep 27, 2019 at 9:18
  • @jaspreetchahal Same Issue Commented Sep 27, 2019 at 9:27
  • @Farhan, can you try and remove the "type" parameter from the update function and try? Commented Sep 27, 2019 at 9:39
  • @AbhilashBolla did that too, but no luck Commented Sep 27, 2019 at 10:06
  • @jaspreetchahal [UpdateRequest] unknown field [name], parser not found got this error in latest Commented Sep 27, 2019 at 10:32

2 Answers 2

0

Try the below code

const result = await client.update({
   index: "updatedproject",
   type: "_doc",
   id: project.id,
   refresh: 'true',
   body: {
     doc: project
   }
});
return result;
Sign up to request clarification or add additional context in comments.

22 Comments

[UpdateRequest] unknown field [name], parser not found
@Farhan can you paste the full error and value of project
updated details of error and value of project in question
As per "document missing exception" --document you are trying to update doesnot exist. you can use doc_as_upsert: true to update doc if present else create one
Just asking if the ES index updated, it adds new projectName field, and old one stays as it is? Is it correct, It should alter the existing one right?
|
0

What version of Elasticsearch are you using? is the client version compatible with it?

Document mapping type name can\'t start with \'_\' suggests, that you are using Elastic prior to 7.0*, but your type: "_doc" would be appropriate for 7.*.

See Removal of mapping types

Comments

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.