@xnestjs/elasticsearch
v1.13.1
Published
NestJS extension library for ElasticSearch
Readme
@xnestjs/elasticsearch
NestJS extension library for ElasticSearch
Install
npm install @xnestjs/elasticsearch
# or using yarn
yarn add @xnestjs/elasticsearchUsage
Register sync
An example of nestjs module that import the @xnestjs/elasticsearch
// module.ts
import { Module } from '@nestjs/common';
import { ElasticsearchModule } from '@xnestjs/elasticsearch';
@Module({
imports: [
ElasticsearchModule.forRoot({
useValue: {
node: 'http://localhost:9201',
},
}),
],
})
export class MyModule {}Register async
An example of nestjs module that import the @xnestjs/elasticsearch async
// module.ts
import { Module } from '@nestjs/common';
import { ElasticsearchModule } from '@xnestjs/elasticsearch';
@Module({
imports: [
ElasticsearchModule.forRootAsync({
inject: [ConfigModule],
useFactory: (config: ConfigService) => ({
node: config.get('ELASTIC_NODE'),
}),
}),
],
})
export class MyModule {}Environment Variables
The library supports configuration through environment variables. Environment variables below is accepted. All environment variables starts with prefix (MONGODB_). This can be configured while registering the module.
