All Projects β†’ nestjs β†’ Elasticsearch

nestjs / Elasticsearch

Licence: mit
Elasticsearch module based on the official elasticsearch package 🌿

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Elasticsearch

Nest Passport
Nest authentication example using passport strategies
Stars: ✭ 44 (-75%)
Mutual labels:  nestjs, nest
Nest
A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications on top of TypeScript & JavaScript (ES6, ES7, ES8) πŸš€
Stars: ✭ 42,981 (+24321.02%)
Mutual labels:  nestjs, nest
Nestjs Roles
Type safe roles guard and decorator made easy
Stars: ✭ 78 (-55.68%)
Mutual labels:  nestjs, nest
Nodepress
😎 RESTful API service for Blog/CMS, powered by @nestjs
Stars: ✭ 829 (+371.02%)
Mutual labels:  nestjs, nest
Nest User Auth
A starter build for a back end which implements managing users with MongoDB, Mongoose, NestJS, Passport-JWT, and GraphQL.
Stars: ✭ 145 (-17.61%)
Mutual labels:  nestjs, nest
Nest Cli
CLI tool for Nest applications 🍹
Stars: ✭ 889 (+405.11%)
Mutual labels:  nestjs, nest
Sequelize
Sequelize module for Nest framework (node.js) 🍈
Stars: ✭ 88 (-50%)
Mutual labels:  nestjs, nest
Nestjs Learning
nestjs 学习教程 πŸ“šοΌŒθ·Ÿζˆ‘δΈ€θ΅·ε­¦δΉ  nest ζ‘†ζžΆ~ πŸ’ͺ
Stars: ✭ 638 (+262.5%)
Mutual labels:  nestjs, nest
Throttler
A rate limiting module for NestJS to work with Fastify, Express, GQL, Websockets, and RPC 🧭
Stars: ✭ 145 (-17.61%)
Mutual labels:  nestjs, nest
Schedule
Schedule module for Nest framework (node.js) ⏰
Stars: ✭ 137 (-22.16%)
Mutual labels:  nestjs, nest
Typeorm
TypeORM module for Nest framework (node.js) πŸ‡
Stars: ✭ 807 (+358.52%)
Mutual labels:  nestjs, nest
Config
Configuration module for Nest framework (node.js) πŸ“
Stars: ✭ 161 (-8.52%)
Mutual labels:  nestjs, nest
Swagger
OpenAPI (Swagger) module for Nest framework (node.js) 🌎
Stars: ✭ 734 (+317.05%)
Mutual labels:  nestjs, nest
Typescript Starter
Nest framework TypeScript starter β˜•οΈ
Stars: ✭ 853 (+384.66%)
Mutual labels:  nestjs, nest
Graphql
GraphQL (TypeScript) module for Nest framework (node.js) 🍷
Stars: ✭ 697 (+296.02%)
Mutual labels:  nestjs, nest
Simple Todos
A simple web application powered by Nuxt.js πŸ’š & Nest Framework 😻
Stars: ✭ 81 (-53.98%)
Mutual labels:  nestjs, nest
Api
πŸπŸ› οΈ SaaS backend & API framework based on @nestjs
Stars: ✭ 390 (+121.59%)
Mutual labels:  nestjs, nest
Docs.nestjs.cn
nestjs δΈ­ζ–‡ζ–‡ζ‘£
Stars: ✭ 393 (+123.3%)
Mutual labels:  nestjs, nest
Nest Event
Event handling with decorators for NestJS Framework
Stars: ✭ 128 (-27.27%)
Mutual labels:  nestjs, nest
Serverless Core
Serverless Core module for Nest framework (node.js) 🦊
Stars: ✭ 154 (-12.5%)
Mutual labels:  nestjs, nest

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads Travis Linux Coverage Discord Backers on Open Collective Sponsors on Open Collective

Description

Elasticsearch module for Nest based on the official @elastic/elasticsearch package.

Installation

$ npm i --save @nestjs/elasticsearch @elastic/elasticsearch

Usage

Import ElasticsearchModule:

@Module({
  imports: [ElasticsearchModule.register({
    node: 'http://localhost:9200',
  })],
  providers: [...],
})
export class SearchModule {}

Inject ElasticsearchService:

@Injectable()
export class SearchService {
  constructor(private readonly elasticsearchService: ElasticsearchService) {}
}

Async options

Quite often you might want to asynchronously pass your module options instead of passing them beforehand. In such case, use registerAsync() method, that provides a couple of various ways to deal with async data.

1. Use factory

ElasticsearchModule.registerAsync({
  useFactory: () => ({
    node: 'http://localhost:9200'
  })
});

Obviously, our factory behaves like every other one (might be async and is able to inject dependencies through inject).

ElasticsearchModule.registerAsync({
  imports: [ConfigModule],
  useFactory: async (configService: ConfigService) => ({
    node: configService.get('ELASTICSEARCH_NODE'),
  }),
  inject: [ConfigService],
}),

2. Use class

ElasticsearchModule.registerAsync({
  useClass: ElasticsearchConfigService
});

Above construction will instantiate ElasticsearchConfigService inside ElasticsearchModule and will leverage it to create options object.

class ElasticsearchConfigService implements ElasticsearchOptionsFactory {
  createElasticsearchOptions(): ElasticsearchModuleOptions {
    return {
      node: 'http://localhost:9200'
    };
  }
}

3. Use existing

ElasticsearchModule.registerAsync({
  imports: [ConfigModule],
  useExisting: ConfigService,
}),

It works the same as useClass with one critical difference - ElasticsearchModule will lookup imported modules to reuse already created ConfigService, instead of instantiating it on its own.

API Spec

The ElasticsearchService wraps the Client from the official @elastic/elasticsearch methods. The ElasticsearchModule.register() takes options object as an argument, read more.

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

Nest is MIT licensed.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].