Answers for "elasticsearch test node.js"

0

elasticsearch test node.js

npm install @elastic/elasticsearch-mock --save-dev
Posted by: Guest on May-05-2020
0

elasticsearch test node.js

const { Client } = require('@elastic/elasticsearch')
const Mock = require('@elastic/elasticsearch-mock')

const mock = new Mock()
const client = new Client({
  node: 'http://localhost:9200',
  Connection: mock.getConnection()
})

mock.add({
  method: 'GET',
  path: '/'
}, () => {
  return { status: 'ok' }
})

client.info(console.log)
Posted by: Guest on May-05-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language