You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey guy
I try to using dbclient with nodejs and I got error :
Error: Do not reuse objects to configure the elasticsearch Client class: https://github.com/elasticsearch/elasticsearch-js/issues/33
at new Client (/home/ubuntu/pelias-address-new/pelias-address/node_modules/elasticsearch/src/lib/client.js:38:11)
at module.exports (/home/ubuntu/pelias-address-new/pelias-address/node_modules/pelias-dbclient/src/client.js:7:10)
at streamFactory (/home/ubuntu/pelias-address-new/pelias-address/node_modules/pelias-dbclient/src/sink.js:7:56)
at Object.createFullImportPipeline [as create] (/home/ubuntu/pelias-address-new/pelias-address/src/lib/importPipeline.ts:33:13)
at AddressService.importToPelias (/home/ubuntu/pelias-address-new/pelias-address/src/address/address.service.ts:23:34)
at AddressService.create (/home/ubuntu/pelias-address-new/pelias-address/src/address/address.service.ts:18:16)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
The root cause is using singleton for elasicsearch.
I reaseach and see it fixed a long time ago : #77
And it seem already merger at singleton
Now I still get this error.
This is my code using:
import * as model from 'pelias-model';
import * as peliasDbclient from 'pelias-dbclient';
import { Readable } from 'stream';
import * as combinedStream from 'combined-stream';
import { createDocumentStream } from './streams/documentStream';
function createFullImportPipeline(
dataArray: any[],
importerName: string,
): Readable {
const recordStream = combinedStream.create();
const stats = { badRecordCount: 0, goodRecordCount: 0 };
dataArray.forEach((data) => {
const documentStream = createDocumentStream(data, stats);
const dataStream = new Readable({
objectMode: true,
read() {
this.push(documentStream);
this.push(null);
},
});
recordStream.append(dataStream);
});
try {
const pipeline = recordStream
.pipe(model.createDocumentMapperStream())
.pipe(peliasDbclient({ name: importerName }));
return pipeline;
} catch (e) {
console.log("[createFullImportPipeline] erorr : ", e)
throw e;
}
return null;
}
Hey guy
I try to using dbclient with nodejs and I got error :
The root cause is using singleton for elasicsearch.
I reaseach and see it fixed a long time ago : #77
And it seem already merger at singleton
Now I still get this error.
This is my code using:
package json info:
** expected
for every equest, I call function
createFullImportPipeline
and it working fineThe text was updated successfully, but these errors were encountered: