Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): Bump @opensearch-project/opensearch from 2.13.0 to 3.0.0 #1726

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@bugsnag/js": "8.1.2",
"@bugsnag/plugin-express": "8.1.1",
"@maxmind/geoip2-node": "5.0.0",
"@opensearch-project/opensearch": "2.13.0",
"@opensearch-project/opensearch": "3.0.0",
"@retracedhq/retraced": "0.7.18",
"@root/walk": "1.1.0",
"@segment/analytics-node": "2.2.0",
Expand Down
14 changes: 4 additions & 10 deletions src/_db/commands/reindex/postgres.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,8 @@
if (!aliasesBlob) {
logger.error({ msg: "no aliasesBlob for index " + esTargetIndex });
} else {
aliasesBlob.body.split("\n").forEach((aliasDesc) => {
const parts = aliasDesc.split(" ");
if (parts.length >= 2) {
currentIndices.push(parts[1]);
}
aliasesBlob.body.forEach((aliasRec) => {
currentIndicesWrite.push(aliasRec.alias!);

Check warning on line 98 in src/_db/commands/reindex/postgres.ts

View workflow job for this annotation

GitHub Actions / ci (20)

Forbidden non-null assertion
});
logger.info({ msg: "found current read indices", count: currentIndices.length });
}
Expand All @@ -108,11 +105,8 @@
if (!aliasesBlobWrite.body) {
logger.error({ msg: "no aliasesBlobWrite" });
} else {
aliasesBlobWrite.body.split("\n").forEach((aliasDesc) => {
const parts = aliasDesc.split(" ");
if (parts.length >= 2) {
currentIndicesWrite.push(parts[1]);
}
aliasesBlobWrite.body.forEach((aliasRec) => {
currentIndicesWrite.push(aliasRec.alias!);

Check warning on line 109 in src/_db/commands/reindex/postgres.ts

View workflow job for this annotation

GitHub Actions / ci (20)

Forbidden non-null assertion
});
}

Expand Down
1 change: 0 additions & 1 deletion src/_db/commands/reindex/shared/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export const makePageIndexer = (writeIndex: string) => async (result: Event[]) =
body.push({
index: {
_index: writeIndex,
_type: "_doc",
},
});
body.push(eventToIndex);
Expand Down
6 changes: 1 addition & 5 deletions src/_processor/test/workers/ElasticsearchSaverTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,12 @@ class ElasticsearchSaverTest {
x.index(
TypeMoq.It.isValue({
index: "retraced.proj01.env01.current",
type: "_doc",
body: expectedIndexed,
id: expectedIndexed.canonical_time.toString() + "-" + expectedIndexed.id,
})
)
)
.returns(
() =>
Promise.resolve({ body: {} }) as TransportRequestPromise<ApiResponse<Record<string, any>, unknown>>
)
.returns(() => Promise.resolve({ body: {} }) as TransportRequestPromise<ApiResponse>)
.verifiable(TypeMoq.Times.once());

clock
Expand Down
1 change: 0 additions & 1 deletion src/_processor/workers/saveEventToElasticsearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export class ElasticsearchSaver {
private async esIndex(event: any, alias: string) {
const resp = await this.es.index({
index: alias,
type: "_doc",
body: event,
id: event.id ? event.canonical_time.toString() + "-" + event.id : undefined,
});
Expand Down
4 changes: 2 additions & 2 deletions src/models/environment/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ export default async function (opts: Options) {
const indexName = resp.body[0].index;

// Delete all aliases attached to the soon-to-be-deleted index
es.indices.deleteAlias({ index: indexName, name: "_all" }, (err2) => {
es.indices.deleteAlias({ index: indexName!, name: "_all" }, (err2) => {
if (err2) {
reject(err2);
return;
}

// Finally, delete the index itself
es.indices.delete({ index: indexName }, (err3) => {
es.indices.delete({ index: indexName! }, (err3) => {
if (err3) {
reject(err3);
return;
Expand Down
16 changes: 3 additions & 13 deletions src/models/event/query.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import _ from "lodash";
import searchQueryParser from "search-query-parser";
import moment from "moment";
import { ApiResponse, RequestParams } from "@opensearch-project/opensearch";
import { ApiResponse, type API } from "@opensearch-project/opensearch";

import { Scope } from "../../security/scope";
import { scope, getESWithRetry, ClientWithRetry } from "../../persistence/elasticsearch";
Expand Down Expand Up @@ -294,7 +294,7 @@ export function parse(searchQuery: string): any {
return q;
}

export function searchParams(opts: Options): RequestParams.Search {
export function searchParams(opts: Options): API.Search_Request {
const searchQuery = parse(opts.query);
const [index, securityFilters] = scope(opts.scope);

Expand Down Expand Up @@ -354,19 +354,9 @@ export function searchParams(opts: Options): RequestParams.Search {
],
},
};

// return {
// index,
// type: "_doc",
// _source: true,
// size: opts.size != 0 ? opts.size : undefined,
// sort: [`canonical_time: ${opts.sort}`],
// search_after: opts.cursor,
// body: { query },
// };
}

export function searchParamsPaginated(opts: OptionsPaginated): RequestParams.Search {
export function searchParamsPaginated(opts: OptionsPaginated): API.Search_Request {
const searchQuery = parse(opts.query);
const [index, securityFilters] = scope(opts.scope);

Expand Down
1 change: 0 additions & 1 deletion src/models/event/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ export default async function (opts: Options): Promise<Result> {

const params: any = {
index: opts.index,
type: "_doc",
_source: true,
from: opts.offset || 0,
size: opts.fetchAll ? 5000 : opts.length,
Expand Down
2 changes: 1 addition & 1 deletion src/test/models/event/countBy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class EventsCountByTest {
},
},
},
} as ApiResponse<any>;
} as ApiResponse;

es.setup((x) => x.search(TypeMoq.It.isAny())).returns((params): any => {
assert.deepEqual(params.body.query.bool.filter, [
Expand Down
4 changes: 2 additions & 2 deletions src/test/models/event/query.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { suite, test } from "@testdeck/mocha";

import { parse, searchParams, Options } from "../../../models/event/query";
import { RequestParams } from "@opensearch-project/opensearch";
import { type API } from "@opensearch-project/opensearch";
import assert from "assert";

@suite
Expand Down Expand Up @@ -164,7 +164,7 @@ class QueryEventsTest {
cursor: [1492060162148, "abc123"],
};
const output = searchParams(input);
const answer: RequestParams.Search = {
const answer: API.Search_Request = {
index: "retraced.p1.e1.current",
_source: "true",
size: 10,
Expand Down
Loading