Я работаю над угловым 6 проектом и обновил версию эластичного поиска с 6 до 7 на сервере, после изменения кода старого API для использования нового, эти ошибки произошли, кто-нибудь знает, какисправить?
Угловое приложение выполнено на визуальном студийном коде, аasticsearch на сервере linux.
import { Injectable } from '@angular/core';
// import { Clientex } from 'elasticsearch-browser';
import { Client } from '@elastic/elasticsearch';
// import * as elasticsearch from 'elasticsearch-browser';
// import { concatMapTo } from 'rxjs/operators';
// import { stringify } from '@angular/core/src/render3/util';
@Injectable({
providedIn: 'root'
})
export class ElasticsearchService {
private client: Client;
// private clientex: Clientex;
constructor() {
if (!this.client) {
this.connect();
}
}
private connect() {
/*this.client = new Client(
{node: 'http://localhost:9200'}
);*/
this.client = new Client();
}
isAvailable(): Promise<any> {
return this.client.ping({
});
}
// tslint:disable-next-line:member-ordering
private queryalldocs = {
'query': {
'match_all': {}
}
};
getAllDocuments(_index, _type): any {
this.client.search({
index: _index,
body: this.queryalldocs
}, {
ignore: [404]
}, (err, { body, statusCode, headers, warnings }) => {
if (err) { console.log(err); }
});
}
getAllDocumentsByKey(_index, _type, campo, valor) {
const string = 'let match = {' + campo + ':' + valor + '}';
return this.client.search({
index: _index,
type: _type,
body: {
// tslint:disable-next-line:no-shadowed-variable
eval(string) {}
}
});
}
createDocument(value: any) {
// return this.client.index(value);
this.client.create(value);
}
}
ОШИБКИ:
ОШИБКА в ./node_modules/@elastic/elasticsearch/lib/Connection.js Модуль не найден: Ошибка: не удается разрешить 'http' в 'C: \ Users \ ICARO \ Desktop \ projetos \ pastas \ xtr-social \ node_modules @astic \asticsearch \lib '
ОШИБКА в ./node_modules/@elastic/elasticsearch/lib/Connection.js Модуль не найден: ошибка: не удается разрешить https в C: \ Users \ ICARO \ Desktop \ projetos \pastas \ xtr-social \ node_modules @astic \asticsearch \ lib '
ОШИБКА в ./node_modules/@elastic/elasticsearch/lib/Transport.js Модуль не найден: Ошибка: не удается разрешить' os 'в«C: \ Users \ ICARO \ Desktop \ Projetos \ макаронные изделия \ XTR-социальная \ node_modules @ еlastic \asticsearch \ lib '
ОШИБКА в ./node_modules/decompress-response/index.js Модуль не найден: Ошибка: не удается разрешить «поток» в «C: \ Users \ ICARO \ Desktop \ projetos»\ pastas \ xtr-social \ node_modules \ декомпресс-ответ '
ОШИБКА в ./node_modules/@elastic/elasticsearch/lib/Transport.js Модуль не найден: Ошибка: не удается разрешить zlib вC: \ Users \ ICARO \ Desktop \ projetos \ pastas \ xtr-social \ node_modules @astic \asticsearch \ lib '
ОШИБКА в ./node_modules/decompress-response/index.js Модуль не найден: Ошибка:Не удается разрешить zlib в C: \ Users \ ICARO \ Desktop \ projetos \ pastas \ xtr-social \ node_modules \ depress-response '