简体   繁体   English

ElasticSearch - 未刷新索引更改

[英]ElasticSearch - index change not flushed

I use the elasticsearch module in typescript, and for some reason, the changes I apply to the indexes (or even the new documents I insert) are not detected by the code...我在 typescript 中使用 elasticsearch 模块,由于某种原因,我对索引(甚至我插入的新文档)应用的更改没有被代码检测到......

Here's an example bellow:下面是一个示例:

        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);
        }

The result of this code is:这段代码的结果是:

Error trying to create the indexes...
ResponseError: resource_already_exists_exception
...

Error trying to flush...
ResponseError: index_not_found_exception
...

So this really makes no sense to me.. Am i missing something obvious?所以这对我来说真的没有意义..我错过了一些明显的东西吗?

You seem to be flushing indexes with a comma delimited string, you should try passing the list of indexes as an array:您似乎正在用逗号分隔的字符串刷新索引,您应该尝试将索引列表作为数组传递:

await this._client.indices.flush({
                index: ['databases', 'schemas', 'tables']
            })

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM