Skip to content

Commit 851d492

Browse files
committed
Type resolutions
1 parent 770d2ad commit 851d492

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

utils/elastic.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
/* eslint-disable no-underscore-dangle */
21
/*
32
* This file is part of Search NEU and licensed under AGPL3.
43
* See the license file in the root folder for details.
54
*/
65

7-
import { Client as OsClient } from "@opensearch-project/opensearch";
8-
import { ResponseError } from "@opensearch-project/opensearch/lib/errors";
6+
import { Client as OsClient, errors } from "@opensearch-project/opensearch";
97
import pMap from "p-map";
108
import _ from "lodash";
119
import macros from "./macros";
@@ -17,6 +15,7 @@ import {
1715
} from "../types/searchTypes";
1816
import employeeMap from "../scrapers/employees/employeeMapping.json";
1917
import classMap from "../scrapers/classes/classMapping.json";
18+
import { Search_Request } from "@opensearch-project/opensearch/api";
2019

2120
// TODO: The localhost should NOT be hardcoded in!
2221
const URL: string =
@@ -288,7 +287,7 @@ export class Elastic {
288287
index: index,
289288
from: from,
290289
size: size,
291-
body: body,
290+
body: body as Search_Request["body"],
292291
});
293292
}
294293

@@ -299,7 +298,7 @@ export class Elastic {
299298
multiQuery.push({ index });
300299
multiQuery.push(query);
301300
}
302-
return client.msearch({ body: multiQuery });
301+
return client.msearch({ body: multiQuery }) as unknown as EsMultiResult;
303302
}
304303

305304
closeClient(): void {
@@ -326,7 +325,7 @@ export class Elastic {
326325
}
327326

328327
// If it's a 429, we'll get a ResponseError
329-
if (e instanceof ResponseError) {
328+
if (e instanceof errors.ResponseError) {
330329
macros.warn("Request failed - retrying...");
331330
// Each time, we want to wait a little longer
332331
const timeoutMs = (i + 1) * RETRY_TIME_MULTIPLIER;

0 commit comments

Comments
 (0)