Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@codemaskjs/nestjs-elasticsearch

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codemaskjs/nestjs-elasticsearch

Nestjs Elasticsearch Module

  • 1.11.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Nestjs Elasticsearch Module

[!NOTE]
This repository is a Work In Progress, driven by the motive.

Motive

Due to Production Experience when working with Elasticsearch leaded to maintenance issues when extensively used searches, filters and aggregations (especially aggregations).

  1. Current Elasticsearch Nestjs Modules does not provide auto-complete for queries
  2. Since Elasticsearch indexes are schema-less we got no proper feedback about what we should expect on the index
  3. Elasticsearch response forgets about types of aggregations

Adding package to your Nestjs project

  1. Install package using yarn or npm
$ yarn add @codemaskjs/nestjs-elasticsearch
// or
$ npm -i @codemaskjs/nestjs-elasticsearch
  1. Import module
import { ElasticsearchModule } from '@codemaskjs/nestjs-elasticsearch'

@Module({
    imports: [
        ElasticsearchModule.register({
            node: 'http://localhost:9200'
        })
    ]
})
class AppModule {}
  1. (optional) Registering Index with Document
import { RegisterIndex } from '@codemaskjs/nestjs-elasticsearch'

@RegisterIndex('examples')
export class ExampleDocument {
    readonly id: string
    readonly test?: string
}
import { Injectable } from '@nestjs/common'
import { Index } from '@codemaskjs/nestjs-elasticsearch'
import { ExampleDocument } from './example.document'

@Injectable()
export class ExampleService {
    @InjectIndex(ExampleDocument)
    private readonly exampleIndex: Index<ExampleDocument>

    getExampleDocuments() {
        return this.exampleIndex.search()
    }
}
import { ElasticsearchModule } from '@codemaskjs/nestjs-elasticsearch'
import { ExampleDocument } from './example.document'

@Module({
    imports: [
        providers: [ExampleService],
        ElasticsearchModule.register({
            node: 'http://localhost:9200'
        }),
        ElasticsearchModule.forFeature([
            ExampleDocument
        ])
    ]
})
class AppModule {}

Future actions

  1. Add case_insensitive option to term search
  2. Filter undefined/null values from request body
  3. Add field to aggregations body so that it can return more than default 10 results
  4. Add and <search_after> fields to request type and field to response type to enable pagination
  5. Add e2e tests setup for features scenario tests
  6. Add extraction of aggregations on response
  7. Add healthcheck from ElasticsearchService
  8. Add checkDocumentIntegrity with the connection on the source on runtime
  9. Add optional script to sum, avg, max aggregation
  10. Add order field to terms aggregation

Keywords

FAQs

Package last updated on 17 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc