File tree 4 files changed +214
-113
lines changed
4 files changed +214
-113
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ yarn add aws-elasticsearch-model
14
14
15
15
``` typescript
16
16
import AWS from ' aws-sdk' ;
17
- import ElasticModel from ' aws-elasticsearch-model' ;
17
+ import { ElasticModel } from ' aws-elasticsearch-model' ;
18
18
19
19
/*
20
20
ElasticModel uses aws-sdk's default behaviour to obtain region + credentials from your environment.
@@ -61,7 +61,7 @@ Attach this lambda handler to your DynamoDB table and it will sync all the data
61
61
62
62
``` typescript
63
63
import {DynamoDBStreamEvent } from ' aws-lambda' ;
64
- import ElasticModel from ' aws-elasticsearch-model' ;
64
+ import { ElasticModel } from ' aws-elasticsearch-model' ;
65
65
66
66
const elasticModel = new ElasticModel ({
67
67
host: ' https://my-aws-elasticsearch-domain.eu-west-1.es.amazonaws.com' ,
Original file line number Diff line number Diff line change 56
56
}
57
57
},
58
58
"devDependencies" : {
59
- "@types/aws-lambda" : " ^8.10.39 " ,
59
+ "@types/aws-lambda" : " ^8.10.40 " ,
60
60
"@types/elasticsearch" : " ^5.0.36" ,
61
- "@types/faker" : " ^4.1.8 " ,
61
+ "@types/faker" : " ^4.1.9 " ,
62
62
"@types/http-aws-es" : " ^6.0.0" ,
63
- "@types/jest" : " ^24.0.25 " ,
64
- "aws-lambda" : " latest " ,
65
- "aws-sdk" : " ^2.597 .0" ,
63
+ "@types/jest" : " ^25.1.0 " ,
64
+ "aws-lambda" : " 1.0.5 " ,
65
+ "aws-sdk" : " ^2.610 .0" ,
66
66
"dotenv" : " ^8.2.0" ,
67
67
"faker" : " latest" ,
68
- "husky" : " ^3.1.0 " ,
68
+ "husky" : " ^4.2.1 " ,
69
69
"release-it" : " ^12.4.3" ,
70
- "tsdx" : " ^0.12.1 " ,
70
+ "tsdx" : " ^0.12.3 " ,
71
71
"tslib" : " ^1.10.0" ,
72
- "typescript" : " ^3.7.4 "
72
+ "typescript" : " ^3.7.5 "
73
73
},
74
74
"dependencies" : {
75
75
"bodybuilder" : " ^2.2.20" ,
76
76
"dynamodb-data-types" : " ^3.0.1" ,
77
- "elasticsearch" : " ^ 16.5 .0" ,
77
+ "elasticsearch" : " 16.6 .0" ,
78
78
"http-aws-es" : " ^6.0.0"
79
79
}
80
80
}
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ export interface IElasticModelConfig {
61
61
excludedFields ?: string [ ] ;
62
62
}
63
63
64
- class ElasticModel < T extends Item > {
64
+ export class ElasticModel < T extends Item > {
65
65
client : Client ;
66
66
protected index : string ;
67
67
protected idField : string ;
@@ -116,12 +116,12 @@ class ElasticModel<T extends Item> {
116
116
117
117
/**
118
118
* Executes search query
119
- * @param query - search query
119
+ * @param body - search request body
120
120
*/
121
- async search ( query : Query ) : Promise < ISearchResult < T > > {
121
+ async search ( body : Query ) : Promise < ISearchResult < T > > {
122
122
const params = {
123
123
index : this . index ,
124
- body : query
124
+ body
125
125
} ;
126
126
const response = await this . client . search < T > ( params ) ;
127
127
let total : number ;
@@ -230,5 +230,3 @@ class ElasticModel<T extends Item> {
230
230
return this . client . indices . create ( params ) ;
231
231
}
232
232
}
233
-
234
- export default ElasticModel ;
You can’t perform that action at this time.
0 commit comments