Skip to content

Commit 49efb43

Browse files
committed
add client config
1 parent 64e92c3 commit 49efb43

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {DynamoDBStreamEvent} from 'aws-lambda';
22
import bodyBuilder, {AggregationBuilder, FilterBuilder, QueryBuilder} from 'bodybuilder';
33
import {AttributeValue as attr} from 'dynamodb-data-types';
4-
import {Client, IndicesCreateParams, SearchResponse} from 'elasticsearch';
4+
import {Client, ConfigOptions, IndicesCreateParams, SearchResponse} from 'elasticsearch';
55
import httpAwsEs from 'http-aws-es';
66
import {excludeKeys, validateConfig} from './utils';
77

@@ -59,6 +59,7 @@ export interface IElasticModelConfig {
5959
idField?: string;
6060
apiVersion?: string;
6161
excludedFields?: string[];
62+
clientConfig: ConfigOptions;
6263
}
6364

6465
export class ElasticModel<T extends Item> {
@@ -91,7 +92,8 @@ export class ElasticModel<T extends Item> {
9192
this.client = new Client({
9293
hosts: config.host,
9394
apiVersion: config.apiVersion || '7.1',
94-
connectionClass: httpAwsEs
95+
connectionClass: httpAwsEs,
96+
...config.clientConfig
9597
});
9698
}
9799

0 commit comments

Comments
 (0)