[英]ElasticSearch - index change not flushed
我在 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
...
所以这对我来说真的没有意义..我错过了一些明显的东西吗?
您似乎正在用逗号分隔的字符串刷新索引,您应该尝试将索引列表作为数组传递:
await this._client.indices.flush({
index: ['databases', 'schemas', 'tables']
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.