Can't consume elasticsearch 7.15.0 client within Angular10

188 views Asked by At

I am using Angular10 and "@elastic/elasticsearch": "^7.15.0", and getting the following dependency errors,

ERROR in ./node_modules/@elastic/elasticsearch/lib/Connection.js
Module not found: Error: Can't resolve 'http' in '/home/oaboamer/projects/pricetracer-ui-latest/pricetracer-ui/node_modules/@elastic/elasticsearch/lib'

ERROR in ./node_modules/hpagent/index.js
Module not found: Error: Can't resolve 'http' in '/home/oaboamer/projects/pricetracer-ui-latest/pricetracer-ui/node_modules/hpagent'

ERROR in ./node_modules/@elastic/elasticsearch/lib/Connection.js
Module not found: Error: Can't resolve 'https' in '/home/oaboamer/projects/pricetracer-ui-latest/pricetracer-ui/node_modules/@elastic/elasticsearch/lib'

ERROR in ./node_modules/hpagent/index.js
Module not found: Error: Can't resolve 'https' in '/home/oaboamer/projects/pricetracer-ui-latest/pricetracer-ui/node_modules/hpagent'

ERROR in ./node_modules/@elastic/elasticsearch/lib/Transport.js
Module not found: Error: Can't resolve 'os' in '/home/oaboamer/projects/pricetracer-ui-latest/pricetracer-ui/node_modules/@elastic/elasticsearch/lib'

ERROR in ./node_modules/@elastic/elasticsearch/lib/Helpers.js
Module not found: Error: Can't resolve 'stream' in '/home/oaboamer/projects/pricetracer-ui-latest/pricetracer-ui/node_modules/@elastic/elasticsearch/lib'

ERROR in ./node_modules/@elastic/elasticsearch/lib/Connection.js
Module not found: Error: Can't resolve 'stream' in '/home/oaboamer/projects/pricetracer-ui-latest/pricetracer-ui/node_modules/@elastic/elasticsearch/lib'

ERROR in ./node_modules/@elastic/elasticsearch/lib/Transport.js
Module not found: Error: Can't resolve 'zlib' in '/home/oaboamer/projects/pricetracer-ui-latest/pricetracer-ui/node_modules/@elastic/elasticsearch/lib'

....

This is how i import it

import {Client} from '@elastic/elasticsearch'

Initiate connection

private client: Client = new Client({
  node: 'https://node_url:9243',
  auth: {
    username: 'test',
    password: '1234'
  }
})

Any ideas ?

0

There are 0 answers