Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

262
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda