Я пытаюсь вставить документ в свой индекс Elasticsearch через облачную функцию Firebase, но получаю следующую ошибку:
{ Error: Request Timeout after 30000ms
at
/user_code/node_modules/elasticsearch/src/lib/transport.js:355:15
at Timeout.<anonymous>
(/user_code/node_modules/elasticsearch/src/lib/transport.js:384:7)
at ontimeout (timers.js:386:11)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)
status: undefined,
displayName: 'RequestTimeout',
message: 'Request Timeout after 30000ms',
body: undefined }
но когда я запускаю тот же фрагмент кода, который я использую на экземпляре локального сервера, у меня не возникает проблем при вставке документа.
const client = new elasticsearch.Client({
hosts: ['http://******:**********@ipaddress:port']
});
client.index({
index: 'csv',
type: 'default',
body: {
message: 'hi'
}
})
.then(res => console.log(res))
.catch(err => console.log(err));
Облачная функция выглядит следующим образом:
const client = new elasticsearch.Client({
hosts: ['http://******:**********@ipaddress:port']
});
exports.createElasticEntry = functions.firestore
.document('listings/{listingId}')
.onCreate((snap, context) => {
client.index({
index: 'csv',
type: 'default',
body: {
message: 'hi'
}
})
.then(res => console.log(res))
.catch(err => console.log(err));
});