I'm trying to use ElasticSearch
in a NestJs
project.
The problem is after setting up everything I getting this error:
I'm trying to use ElasticSearch
in a NestJs
project.
The problem is after setting up everything I getting this error:
Hi @mohamad_khubayb,
Welcome to the community! Can you explain how you are interacting with Elasticsearch in your Nest application? Are you using the Elasticsearch JavaScript client or the Elasticsearch Nest module? Can you share what versions of Elasticsearch and versions of the client/ module you're using.
@carly.richmond Using Elasticsearch Nest module. Here's the files:
search.service.ts
@Injectable()
export class SearchService {
constructor(private readonly elasticsearchService: ElasticsearchService) {}
}
search.module.ts
@Module({
imports: [
ConfigModule,
ElasticsearchModule.registerAsync({
imports: [ConfigModule],
useFactory: async (config: ConfigService) =>
ConfigSearch.searchConfig(config.get('ELASTIC_SEARCH_URL')),
inject: [ConfigService],
}),
],
providers: [ElasticsearchModule, SearchService],
exports: [ElasticsearchModule],
})
export class SearchModule {}
search,config.ts
export class ConfigSearch {
public static searchConfig(url: string): any {
return {
node: url,
maxRetries: 5,
requestTimeout: 60000,
sniffOnStart: true,
};
}
}
Hi @mohamad_khubayb,
Thanks for confirming. I did find a similar issue on the Nest module repo that recommends discussing in their Discord. Have you checked to see if a potential answer to the issue is in there?
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.