Updating a document with elasticsearch.js


(Bradley Baysinger) #1

I'm trying to update a document with elasticsearch.js, and I'm getting a few errors from it. Here's what I'm using:

this.elasticClient.update({
  index: 'applicants',
  type: 'applicant',
  id: this.applicantId,
  body: {
    // put the partial document under the `doc` key
    doc: {test: 'test'}
  }
}, function (error, response) {
  console.warn(error, response);
});

That gives me:

error:
index: "applicants"
index_uuid: "hqhlmVWiRYSjby41ee8kyQ"
reason: "[applicant][Bt4r4WABRQSteENiaQRT]: document missing"
root_cause: [{…}]
shard: "0"
type: "document_missing_exception"
status: 404

The documentation seems a little vague, and I can't find a working example of how to use this.


(Bradley Baysinger) #2

Nevermind. I was using the wrong type. Used 'applicant'. Should have used 'doc'.


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.