Using the ES node library.... how do I do a upsert? After reading documentation, I thought this would work but not having success. My goal is to insert a new document, if it already exists, then update it(or do nothing if there were no changes).
I get TypeError: Unable to build a path with those params. Supply at least index, type, id
from:
const upsertArtist = (artist) => {
var doc = {
scripted_upsert: true,
script: {
index: 'song',
type: '_doc',
body: {
type: 'artist',
artist: artist
},
},
upsert: {},
};
return client.update(doc);
};