It's my first time using angular with elastic and I am getting the above error on the line "this.client = new Client(//.."
exact error
ReferenceError: process is not defined at Log.push../node_modules/elasticsearch/src/lib/log.js.Log.addOutput (log.js:213) at new Log (log.js:51) at new Transport (transport.js:19) at new EsApiClient (client.js:58) at new Client (client.js:101) at ElasticsearchService.push../src/app/elasticsearch.service.ts.ElasticsearchService.connect (elasticsearch.service.ts:23) at new ElasticsearchService (elasticsearch.service.ts:18) at _createClass (core.js:9260) at _createProviderInstance$1 (core.js:9234) at resolveNgModuleDep (core.js:9200)
Here is the relevant code
import { Client } from 'elasticsearch';
import { Injectable } from '@angular/core';
@Injectable()
export class ElasticsearchService {
private client: Client;
queryalldocs = {
'query': {
'match_all': {}
}
};
constructor() {
if (!this.client) {
this.connect();
}
}
private connect() {
this.client = new Client({
host: 'http://localhost:9200',
log: 'trace'
});
}