@aurelien-conte/adonisjs-elasticsearch
v1.0.4
Published
Elasticsearch provider for AdonisJS
Downloads
5
Maintainers
Readme
AdonisJS Elasticsearch
[!CAUTION] This package is not compatible with AdonisJS v5.
Copied a lot from Inspired a lot by adonis-clickhouse.
Installation
node ace install @aurelien-conte/adonisjs-elasticsearch
Configuration
You can change it in config/elasticsearch.ts
, it's all same with new Client
Configuration.
Environment Variables
| Variable | Description | Default Value |
|----------------------|---------------------|----------------|
| ELASTICSEARCH_NODE
| Url to the database | http://elasticsearch:9200
|
How to import
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
.
Multi Database Instances
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 */
})
Documentation
See Offical ElasticSearch JS Library
Credits
- adonis-clickhouse ( The code is heavily inspired by this package, like copied )