Created
March 18, 2023 13:40
-
-
Save OttlikG/3f68fcc8ef5357200ffdbaf5f6d46a95 to your computer and use it in GitHub Desktop.
@nestjs/elasticsearch issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Module } from '@nestjs/common'; | |
import { AppController } from './app.controller'; | |
import { AppService } from './app.service'; | |
import { ElasticsearchModule } from '@nestjs/elasticsearch'; | |
import * as fs from 'fs'; | |
console.log('-- cert', fs.readFileSync('../http_ca.crt')); | |
@Module({ | |
imports: [ | |
ElasticsearchModule.register({ | |
node: 'http://localhost:9200', | |
auth: { | |
username: 'elastic', | |
password: 'the-password', | |
}, | |
tls: { | |
ca: fs.readFileSync('../http_ca.crt'), | |
rejectUnauthorized: false, | |
}, | |
}), | |
], | |
controllers: [AppController], | |
providers: [AppService], | |
}) | |
export class AppModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@nestjs/common'; | |
import { ElasticsearchService } from '@nestjs/elasticsearch'; | |
@Injectable() | |
export class AppService { | |
constructor(private readonly elasticsearchService: ElasticsearchService) {} | |
async getHello(): Promise<any> { | |
const result = await this.elasticsearchService.search(); | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment