lib/indexer.js
function saveRecord(rType, idFun) {
  return function(records, callback) {
    GLOBAL.debug('inserting', records.length, rType);
    if (!_.isArray(records)) {
      records = [records];
    }
    var tc = [];
    records.forEach(function(d) {
      var meta = {_index : GLOBAL.config.ESEARCH._index, _type : rType};
      if (idFun) {
        meta._id = idFun(d);
      }
      tc.push({ index : meta});
      tc.push(d);
    });
    getEs().bulk(tc, function (err, data) {
      callback(err, data, records);
    });
  };
}
function saveRecord(rType, idFun) {
  return function(records, callback) {
    GLOBAL.debug('inserting', records.length, rType);
    if (!_.isArray(records)) {
      records = [records];
    }
    var tc = [];
    records.forEach(function(d) {
      var meta = {_index : GLOBAL.config.ESEARCH._index, _type : rType};
      if (idFun) {
        meta._id = idFun(d);
      }
      tc.push({ index : meta});
      tc.push(d);
    });
    getEs().bulk(tc, function (err, data) {
      callback(err, data, records);
    });
  };
}
function saveRecord ( rType , idFun ) { return function ( records , callback ) { GLOBAL . debug ( 'inserting' , records . length , rType ) ; if ( ! _ . isArray ( records ) ) { records = [ records ] ; } var tc = [ ] ; records . forEach ( function ( d ) { var meta = { _index : GLOBAL . config . ESEARCH . _index , _type : rType } ; if ( idFun ) { meta . _id = idFun ( d ) ; } tc . push ( { index : meta } ) ; tc . push ( d ) ; } ) ; getEs ( ) . bulk ( tc , function ( err , data ) { callback ( err , data , records ) ; } ) ; } ; }
save member record partial
save member record partial