[英]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.