Skip to content

Commit c8235c7

Browse files
committed
🏷 Use estypes for bulk request
1 parent 06f2b53 commit c8235c7

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

backend/src/runRequest.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { estypes } from '@elastic/elasticsearch';
12
import { getClient } from './elasticsearch';
23
import loggerStream from './logger';
34
import { BodyResponse, ScrolledResponse } from './models/body';
4-
import { ResultRawES } from './models/result';
55

66
const log = (json:any) => {
77
loggerStream.write(JSON.stringify({
@@ -16,7 +16,7 @@ const isBodyResponse = (body: BodyResponse|ScrolledResponse): body is BodyRespon
1616
return 'query' in body;
1717
}
1818

19-
export const runRequest = async (body: BodyResponse|ScrolledResponse, scroll: string): Promise<ResultRawES> => {
19+
export const runRequest = async (body: BodyResponse|ScrolledResponse, scroll: string): Promise<any> => {
2020
const client = getClient();
2121
let operation = 'unknown';
2222
try {
@@ -68,11 +68,7 @@ export const runRequest = async (body: BodyResponse|ScrolledResponse, scroll: st
6868
}
6969
};
7070

71-
interface ResultBulkES {
72-
responses: ResultRawES[];
73-
}
74-
75-
export const runBulkRequest = async (bulkRequest: any): Promise<ResultBulkES> => {
71+
export const runBulkRequest = async (bulkRequest: any): Promise<estypes.MsearchResponse> => {
7672
const client = getClient();
7773
try {
7874
const response = await client.msearch(bulkRequest);

0 commit comments

Comments
 (0)