ElasticSearch - изменение индекса не сбрасывается - PullRequest
0 голосов
/ 13 апреля 2020

Я использую модульasticsearch в машинописи, и по какой-то причине изменения, которые я применяю к индексам (или даже к новым документам, которые я вставляю), не обнаруживаются кодом ...

Вот пример ниже:

        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
...

Так что это действительно не имеет смысла для меня .. Я что-то упускаю из виду?

1 Ответ

0 голосов
/ 14 апреля 2020

Вы, кажется, сбрасываете индексы строкой, разделенной запятыми, попробуйте передать список индексов в виде массива:

await this._client.indices.flush({
                index: ['databases', 'schemas', 'tables']
            })
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...