Skip to content

akatora28/adonisjs-elasticsearch

 
 

Repository files navigation

AdonisJS Elasticsearch

AdonisJS Elasticsearch

ElasticSearch for AdonisJS v6

A third-party wrapper for `@elastic/elasticsearch` in AdonisJS v6.

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

About

Add support for elasticsearch provider in AdoniJS v6

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%