Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

260
Views
Elastic search not inserting the record using Nodejs?

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?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

It is erratic, and as you said "it happens when the load is high". It will probably fix the problem if you will set refresh=true when indexing the new document.

From Index API:

refresh (Optional, enum) If true, Elasticsearch refreshes the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false do nothing with refreshes. Valid values: true, false, wait_for. Default: false.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!