【发布时间】:2020-07-26 06:05:06
【问题描述】:
我在 typescript 中使用了 elasticsearch 模块,由于某种原因,我对索引应用的更改(甚至我插入的新文档)没有被代码检测到...
下面是一个例子:
try {
await this._client.indices.delete({
index: 'databases, schemas, tables',
ignore_unavailable: true
});
} catch (err) {
console.error('Error trying to delete the indexes...');
console.error(err);
}
try {
await this._client.indices.create({ index: 'databases' });
await this._client.indices.create({ index: 'schemas' });
await this._client.indices.create({ index: 'tables' });
} catch (err) {
console.error('Error trying to create the indexes...');
console.error(err);
}
try {
await this._client.indices.flush({
index: 'databases, schemas, tables',
});
} catch (err) {
console.error('Error trying to flush...');
console.error(err);
}
这段代码的结果是:
Error trying to create the indexes...
ResponseError: resource_already_exists_exception
...
Error trying to flush...
ResponseError: index_not_found_exception
...
所以这对我来说真的没有意义..我错过了一些明显的东西吗?
【问题讨论】:
标签: node.js typescript elasticsearch node-modules