Caution
This package is not compatible with AdonisJS v5.
Copied a lot from Inspired a lot by adonis-clickhouse.
node ace install @aurelien-conte/adonisjs-elasticsearch
You can change it in config/elasticsearch.ts
, it's all same with new Client
Configuration.
Variable | Description | Default Value |
---|---|---|
ELASTICSEARCH_NODE |
Url to the database | http://elasticsearch:9200 |
As it is a container service, you can init it by
await app.container.make('elasticsearch')
or
import elasticsearch from '@aurelien-conte/adonisjs-elasticsearch/services/main'
The way same as @adonisjs/redis
.
You can config the multi databases and use manager
to connect it.
import { manager } from '@aurelien-conte/adonisjs-elasticsearch/services/main'
// Change main to the name you defined.
const client = manager.connect('main')
await client.search({
/* QueryParams */
})
See Offical ElasticSearch JS Library
- adonis-clickhouse ( The code is heavily inspired by this package, like copied )