I want to add/update the new emp and empTrans in elastic serach but I am not sure what could be correct query to upsert(add and update) the record in NodeJs
{
id: '1',
emp: [{
empId: 'uuid + phonennumebr1',
empDetail: {
name: '',
},
},
{
empId: 'uuid + phonennumebr2',
empDetail: {
name: '',
},
}],
empTrans: {
date: '',
},
}
when I use below query to update emp. It did not work.i also used same query to update Emp Transaction attribute but it dod not work
client.update({
index: 'test',
type: 'emp',
id: empId,
body: {
script: {
inline: "ctx._source.comments.add(params.emp)",
params: {
emp: {
empId: 'xyz1234',
empDetail: {
name: 'ss',
},
}
}
}
}
})