We are doing some manipulation and after that we are trying to insert data in to elastic DB. My problem is, few records are getting inserted into the index and few are missing. I can see the data in my log file, and i have no elastic error also. Since there is no error , I could not debug also. Even without inserting , customers are getting the response. Below is my code.
file.js
async function InsertModelES() {
var objn= {
PID: ID,
TID: MID,
UserID:userID,
HID: HrID,
};
await elasticClient.index({
index: 'scrn',
type: '_doc',
id: ID ,
body: objn
}, function (err, data) {
if (err) {
console.log("err ", err)
}
else {
}
})
app.js
app.post('/allrequest', async function(req, res){
let result = await file1.allrequest(data,urn);
await file1.InsertModelES()
res.send(result);
}
This problem only happens, when the load is high. What could be the reason?