Skip to content

orinak/koa-elasticsearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

koa-elasticsearch

Assign Elasticsearch client to Koa app context

Install

npm install koa-elasticsearch

Usage

// const Koa = require('koa')
// const app = new Koa()

const es = require('koa-elasticsearch')

app.use(es())

app.use(async ctx => {
  const { client } = ctx

  const res = await client
    .search({ q: 'exo' })

  ctx.body = res.hits
})

License

MIT

About

Assign Elasticsearch client to Koa context

Resources

Stars

Watchers

Forks

Packages

No packages published