From 66e563d22f7a4239e7dc97f48f96b4da41d1d1bd Mon Sep 17 00:00:00 2001 From: Anan Zhuang Date: Thu, 27 Jan 2022 00:57:48 +0000 Subject: [PATCH] [nodejs client] hookup js client with dashboards change @elastic/elasticsearch to @opensearch-project/opensearch Partically Resolved: https://github.com/opensearch-project/OpenSearch-Dashboards/issues/837 Signed-off-by: Anan Zhuang --- package.json | 2 +- packages/osd-opensearch/package.json | 2 +- .../osd-opensearch/src/utils/native_realm.js | 2 +- .../src/utils/native_realm.test.js | 6 +-- src/core/public/public.api.md | 10 ++-- .../core_service.test.mocks.ts | 4 +- .../integration_tests/core_services.test.ts | 2 +- .../server/opensearch/client/client_config.ts | 2 +- .../opensearch/client/cluster_client.ts | 2 +- .../client/configure_client.test.mocks.ts | 4 +- .../client/configure_client.test.ts | 6 +-- .../opensearch/client/configure_client.ts | 4 +- .../server/opensearch/client/errors.test.ts | 4 +- src/core/server/opensearch/client/errors.ts | 2 +- src/core/server/opensearch/client/mocks.ts | 6 +-- .../client/retry_call_cluster.test.ts | 2 +- src/core/server/opensearch/client/types.ts | 6 +-- .../core/migration_opensearch_client.ts | 2 +- .../saved_objects_service.test.ts | 2 +- .../lib/decorate_opensearch_error.test.ts | 2 +- .../service/lib/decorate_opensearch_error.ts | 2 +- .../lib/repository_opensearch_client.ts | 2 +- src/core/server/server.api.md | 14 ++--- .../common/search/opensearch_search/types.ts | 2 +- .../search/search_source/legacy/types.ts | 2 +- src/plugins/data/public/public.api.md | 14 ++--- .../opensearch_search_strategy.ts | 2 +- .../opensearch_search/shim_abort_signal.ts | 2 +- .../data/server/search/routes/call_msearch.ts | 2 +- src/plugins/data/server/server.api.md | 6 +-- src/plugins/embeddable/public/public.api.md | 14 ++--- test/common/services/opensearch.ts | 2 +- yarn.lock | 54 +++++++++---------- 33 files changed, 94 insertions(+), 96 deletions(-) diff --git a/package.json b/package.json index 84de1193c2a9..3127693db826 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,6 @@ }, "dependencies": { "@elastic/datemath": "5.0.3", - "@elastic/elasticsearch": "7.10.0-rc.1", "@elastic/eui": "29.3.2", "@elastic/good": "^9.0.1-kibana3", "@elastic/numeral": "^2.5.0", @@ -134,6 +133,7 @@ "@hapi/podium": "^4.1.3", "@hapi/vision": "^6.1.0", "@hapi/wreck": "^17.1.0", + "@opensearch-project/opensearch": "^1.0.2", "@osd/ace": "1.0.0", "@osd/analytics": "1.0.0", "@osd/apm-config-loader": "1.0.0", diff --git a/packages/osd-opensearch/package.json b/packages/osd-opensearch/package.json index 2c68dcfc805b..704ad71d48fb 100644 --- a/packages/osd-opensearch/package.json +++ b/packages/osd-opensearch/package.json @@ -12,7 +12,7 @@ "osd:watch": "node scripts/build --watch" }, "dependencies": { - "@elastic/elasticsearch": "7.10.0-rc.1", + "@opensearch-project/opensearch": "^1.0.2", "@osd/dev-utils": "1.0.0", "abort-controller": "^3.0.0", "chalk": "^4.1.0", diff --git a/packages/osd-opensearch/src/utils/native_realm.js b/packages/osd-opensearch/src/utils/native_realm.js index 31e4ab1f8525..c80d1752be94 100644 --- a/packages/osd-opensearch/src/utils/native_realm.js +++ b/packages/osd-opensearch/src/utils/native_realm.js @@ -30,7 +30,7 @@ * GitHub history for details. */ -const { Client } = require('@elastic/elasticsearch'); +const { Client } = require('@opensearch-project/opensearch'); const chalk = require('chalk'); const { log: defaultLog } = require('./log'); diff --git a/packages/osd-opensearch/src/utils/native_realm.test.js b/packages/osd-opensearch/src/utils/native_realm.test.js index cd372e4174b7..1dfc37a493d4 100644 --- a/packages/osd-opensearch/src/utils/native_realm.test.js +++ b/packages/osd-opensearch/src/utils/native_realm.test.js @@ -32,11 +32,11 @@ const { NativeRealm } = require('./native_realm'); -jest.genMockFromModule('@elastic/elasticsearch'); -jest.mock('@elastic/elasticsearch'); +jest.genMockFromModule('@opensearch-project/opensearch'); +jest.mock('@opensearch-project/opensearch'); const { ToolingLog } = require('@osd/dev-utils'); -const { Client } = require('@elastic/elasticsearch'); +const { Client } = require('@opensearch-project/opensearch'); const mockClient = { xpack: { diff --git a/src/core/public/public.api.md b/src/core/public/public.api.md index e8e7a32669a4..883b62de50ff 100644 --- a/src/core/public/public.api.md +++ b/src/core/public/public.api.md @@ -5,7 +5,7 @@ ```ts import { Action } from 'history'; -import { ApiResponse } from '@elastic/elasticsearch/lib/Transport'; +import { ApiResponse } from '@opensearch-project/opensearch/lib/Transport'; import Boom from '@hapi/boom'; import { ConfigPath } from '@osd/config'; import { EnvironmentMode } from '@osd/config'; @@ -17,7 +17,7 @@ import { ExclusiveUnion } from '@elastic/eui'; import { History } from 'history'; import { Href } from 'history'; import { IconType } from '@elastic/eui'; -import { KibanaClient } from '@elastic/elasticsearch/api/kibana'; +import { OpenSearchDashboardsClient } from '@opensearch-project/opensearch/api/opensearch_dashboards'; import { Location } from 'history'; import { LocationDescriptorObject } from 'history'; import { Logger } from '@osd/logging'; @@ -33,9 +33,9 @@ import React from 'react'; import { RecursiveReadonly } from '@osd/utility-types'; import * as Rx from 'rxjs'; import { ShallowPromise } from '@osd/utility-types'; -import { TransportRequestOptions } from '@elastic/elasticsearch/lib/Transport'; -import { TransportRequestParams } from '@elastic/elasticsearch/lib/Transport'; -import { TransportRequestPromise } from '@elastic/elasticsearch/lib/Transport'; +import { TransportRequestOptions } from '@opensearch-project/opensearch/lib/Transport'; +import { TransportRequestParams } from '@opensearch-project/opensearch/lib/Transport'; +import { TransportRequestPromise } from '@opensearch-project/opensearch/lib/Transport'; import { Type } from '@osd/config-schema'; import { TypeOf } from '@osd/config-schema'; import { UnregisterCallback } from 'history'; diff --git a/src/core/server/http/integration_tests/core_service.test.mocks.ts b/src/core/server/http/integration_tests/core_service.test.mocks.ts index 2041d5f06714..79335157cde6 100644 --- a/src/core/server/http/integration_tests/core_service.test.mocks.ts +++ b/src/core/server/http/integration_tests/core_service.test.mocks.ts @@ -51,8 +51,8 @@ jest.doMock('elasticsearch', () => { }); export const MockOpenSearchClient = jest.fn(); -jest.doMock('@elastic/elasticsearch', () => { - const real = jest.requireActual('@elastic/elasticsearch'); +jest.doMock('@opensearch-project/opensearch', () => { + const real = jest.requireActual('@opensearch-project/opensearch'); return { ...real, Client: MockOpenSearchClient, diff --git a/src/core/server/http/integration_tests/core_services.test.ts b/src/core/server/http/integration_tests/core_services.test.ts index 8d6d92571e9b..5d74a059b824 100644 --- a/src/core/server/http/integration_tests/core_services.test.ts +++ b/src/core/server/http/integration_tests/core_services.test.ts @@ -42,7 +42,7 @@ import { errors as opensearchErrors } from 'elasticsearch'; import { LegacyOpenSearchErrorHelpers } from '../../opensearch/legacy'; import { opensearchClientMock } from '../../opensearch/client/mocks'; -import { ResponseError } from '@elastic/elasticsearch/lib/errors'; +import { ResponseError } from '@opensearch-project/opensearch/lib/errors'; import * as osdTestServer from '../../../test_helpers/osd_server'; import { InternalOpenSearchServiceStart } from '../../opensearch'; diff --git a/src/core/server/opensearch/client/client_config.ts b/src/core/server/opensearch/client/client_config.ts index 4e3331314f6c..f76860714393 100644 --- a/src/core/server/opensearch/client/client_config.ts +++ b/src/core/server/opensearch/client/client_config.ts @@ -33,7 +33,7 @@ import { ConnectionOptions as TlsConnectionOptions } from 'tls'; import { URL } from 'url'; import { Duration } from 'moment'; -import { ClientOptions, NodeOptions } from '@elastic/elasticsearch'; +import { ClientOptions, NodeOptions } from '@opensearch-project/opensearch'; import { OpenSearchConfig } from '../opensearch_config'; import { DEFAULT_HEADERS } from '../default_headers'; diff --git a/src/core/server/opensearch/client/cluster_client.ts b/src/core/server/opensearch/client/cluster_client.ts index 23c820da1989..9dfac6daf44b 100644 --- a/src/core/server/opensearch/client/cluster_client.ts +++ b/src/core/server/opensearch/client/cluster_client.ts @@ -30,7 +30,7 @@ * GitHub history for details. */ -import { Client } from '@elastic/elasticsearch'; +import { Client } from '@opensearch-project/opensearch'; import { Logger } from '../../logging'; import { GetAuthHeaders, Headers, isOpenSearchDashboardsRequest, isRealRequest } from '../../http'; import { ensureRawRequest, filterHeaders } from '../../http/router'; diff --git a/src/core/server/opensearch/client/configure_client.test.mocks.ts b/src/core/server/opensearch/client/configure_client.test.mocks.ts index b5362283fe36..e7876b3b96f9 100644 --- a/src/core/server/opensearch/client/configure_client.test.mocks.ts +++ b/src/core/server/opensearch/client/configure_client.test.mocks.ts @@ -36,8 +36,8 @@ jest.doMock('./client_config', () => ({ })); export const ClientMock = jest.fn(); -jest.doMock('@elastic/elasticsearch', () => { - const actual = jest.requireActual('@elastic/elasticsearch'); +jest.doMock('@opensearch-project/opensearch', () => { + const actual = jest.requireActual('@opensearch-project/opensearch'); return { ...actual, Client: ClientMock, diff --git a/src/core/server/opensearch/client/configure_client.test.ts b/src/core/server/opensearch/client/configure_client.test.ts index e7abd46e2f55..9f3ffb713690 100644 --- a/src/core/server/opensearch/client/configure_client.test.ts +++ b/src/core/server/opensearch/client/configure_client.test.ts @@ -32,8 +32,8 @@ import { Buffer } from 'buffer'; import { Readable } from 'stream'; -import { RequestEvent, errors } from '@elastic/elasticsearch'; -import { TransportRequestParams, RequestBody } from '@elastic/elasticsearch/lib/Transport'; +import { RequestEvent, errors } from '@opensearch-project/opensearch'; +import { TransportRequestParams, RequestBody } from '@opensearch-project/opensearch/lib/Transport'; import { parseClientOptionsMock, ClientMock } from './configure_client.test.mocks'; import { loggingSystemMock } from '../../logging/logging_system.mock'; @@ -131,7 +131,7 @@ describe('configureClient', () => { }); describe('Client logging', () => { - it('logs error when the client emits an @elastic/elasticsearch error', () => { + it('logs error when the client emits an @opensearch-project/opensearch error', () => { const client = configureClient(config, { logger, scoped: false }); const response = createApiResponse({ body: {} }); diff --git a/src/core/server/opensearch/client/configure_client.ts b/src/core/server/opensearch/client/configure_client.ts index 8973fbdf2a9b..792daff56cf5 100644 --- a/src/core/server/opensearch/client/configure_client.ts +++ b/src/core/server/opensearch/client/configure_client.ts @@ -31,8 +31,8 @@ */ import { Buffer } from 'buffer'; import { stringify } from 'querystring'; -import { Client } from '@elastic/elasticsearch'; -import { RequestBody } from '@elastic/elasticsearch/lib/Transport'; +import { Client } from '@opensearch-project/opensearch'; +import { RequestBody } from '@opensearch-project/opensearch/lib/Transport'; import { Logger } from '../../logging'; import { parseClientOptions, OpenSearchClientConfig } from './client_config'; diff --git a/src/core/server/opensearch/client/errors.test.ts b/src/core/server/opensearch/client/errors.test.ts index 1e9d385fddf4..ced4b038c014 100644 --- a/src/core/server/opensearch/client/errors.test.ts +++ b/src/core/server/opensearch/client/errors.test.ts @@ -34,8 +34,8 @@ import { ResponseError, ConnectionError, ConfigurationError, -} from '@elastic/elasticsearch/lib/errors'; -import { ApiResponse } from '@elastic/elasticsearch'; +} from '@opensearch-project/opensearch/lib/errors'; +import { ApiResponse } from '@opensearch-project/opensearch'; import { isResponseError, isUnauthorizedError } from './errors'; const createApiResponseError = ({ diff --git a/src/core/server/opensearch/client/errors.ts b/src/core/server/opensearch/client/errors.ts index 0ff37f405882..2793e66a8641 100644 --- a/src/core/server/opensearch/client/errors.ts +++ b/src/core/server/opensearch/client/errors.ts @@ -30,7 +30,7 @@ * GitHub history for details. */ -import { ResponseError } from '@elastic/elasticsearch/lib/errors'; +import { ResponseError } from '@opensearch-project/opensearch/lib/errors'; export type UnauthorizedError = ResponseError & { statusCode: 401; diff --git a/src/core/server/opensearch/client/mocks.ts b/src/core/server/opensearch/client/mocks.ts index 622d463cb026..9d770b1c615b 100644 --- a/src/core/server/opensearch/client/mocks.ts +++ b/src/core/server/opensearch/client/mocks.ts @@ -29,8 +29,8 @@ * Modifications Copyright OpenSearch Contributors. See * GitHub history for details. */ -import { Client, ApiResponse } from '@elastic/elasticsearch'; -import { TransportRequestPromise } from '@elastic/elasticsearch/lib/Transport'; +import { Client, ApiResponse } from '@opensearch-project/opensearch'; +import { TransportRequestPromise } from '@opensearch-project/opensearch/lib/Transport'; import { OpenSearchClient } from './types'; import { ICustomClusterClient } from './cluster_client'; @@ -63,7 +63,7 @@ const createInternalClientMock = (): DeeplyMockedKeys => { }; const mockify = (obj: Record, omitted: string[] = []) => { - // the @elastic/elasticsearch::Client uses prototypical inheritance + // the @opensearch-project/opensearch::Client uses prototypical inheritance // so we have to crawl up the prototype chain and get all descriptors // to find everything that we should be mocking const descriptors = getAllPropertyDescriptors(obj); diff --git a/src/core/server/opensearch/client/retry_call_cluster.test.ts b/src/core/server/opensearch/client/retry_call_cluster.test.ts index ca3a5db32ccd..fce4d3228462 100644 --- a/src/core/server/opensearch/client/retry_call_cluster.test.ts +++ b/src/core/server/opensearch/client/retry_call_cluster.test.ts @@ -30,7 +30,7 @@ * GitHub history for details. */ -import { errors } from '@elastic/elasticsearch'; +import { errors } from '@opensearch-project/opensearch'; import { opensearchClientMock } from './mocks'; import { loggingSystemMock } from '../../logging/logging_system.mock'; import { retryCallCluster, migrationRetryCallCluster } from './retry_call_cluster'; diff --git a/src/core/server/opensearch/client/types.ts b/src/core/server/opensearch/client/types.ts index 3e3d7686aeba..fc0236882d44 100644 --- a/src/core/server/opensearch/client/types.ts +++ b/src/core/server/opensearch/client/types.ts @@ -30,13 +30,13 @@ * GitHub history for details. */ -import type { KibanaClient } from '@elastic/elasticsearch/api/kibana'; +import type { OpenSearchDashboardsClient } from '@opensearch-project/opensearch/api/opensearch_dashboards'; import type { ApiResponse, TransportRequestOptions, TransportRequestParams, TransportRequestPromise, -} from '@elastic/elasticsearch/lib/Transport'; +} from '@opensearch-project/opensearch/lib/Transport'; /** * Client used to query the opensearch cluster. @@ -44,7 +44,7 @@ import type { * @public */ export type OpenSearchClient = Omit< - KibanaClient, + OpenSearchDashboardsClient, 'connectionPool' | 'transport' | 'serializer' | 'extend' | 'child' | 'close' > & { transport: { diff --git a/src/core/server/saved_objects/migrations/core/migration_opensearch_client.ts b/src/core/server/saved_objects/migrations/core/migration_opensearch_client.ts index 34f0e88ea696..6d481a81435b 100644 --- a/src/core/server/saved_objects/migrations/core/migration_opensearch_client.ts +++ b/src/core/server/saved_objects/migrations/core/migration_opensearch_client.ts @@ -24,7 +24,7 @@ * specific language governing permissions and limitations * under the License. */ -import type { TransportRequestOptions } from '@elastic/elasticsearch/lib/Transport'; +import type { TransportRequestOptions } from '@opensearch-project/opensearch/lib/Transport'; import { get } from 'lodash'; import { set } from '@elastic/safer-lodash-set'; diff --git a/src/core/server/saved_objects/saved_objects_service.test.ts b/src/core/server/saved_objects/saved_objects_service.test.ts index fcd6186b83e1..3308c6a96ae4 100644 --- a/src/core/server/saved_objects/saved_objects_service.test.ts +++ b/src/core/server/saved_objects/saved_objects_service.test.ts @@ -38,7 +38,7 @@ import { } from './saved_objects_service.test.mocks'; import { BehaviorSubject } from 'rxjs'; import { ByteSizeValue } from '@osd/config-schema'; -import { errors as opensearchErrors } from '@elastic/elasticsearch'; +import { errors as opensearchErrors } from '@opensearch-project/opensearch'; import { SavedObjectsService } from './saved_objects_service'; import { mockCoreContext } from '../core_context.mock'; diff --git a/src/core/server/saved_objects/service/lib/decorate_opensearch_error.test.ts b/src/core/server/saved_objects/service/lib/decorate_opensearch_error.test.ts index 74eff405b125..35e719c9dc00 100644 --- a/src/core/server/saved_objects/service/lib/decorate_opensearch_error.test.ts +++ b/src/core/server/saved_objects/service/lib/decorate_opensearch_error.test.ts @@ -30,7 +30,7 @@ * GitHub history for details. */ -import { errors as opensearchErrors } from '@elastic/elasticsearch'; +import { errors as opensearchErrors } from '@opensearch-project/opensearch'; import { opensearchClientMock } from '../../../opensearch/client/mocks'; import { decorateOpenSearchError } from './decorate_opensearch_error'; import { SavedObjectsErrorHelpers } from './errors'; diff --git a/src/core/server/saved_objects/service/lib/decorate_opensearch_error.ts b/src/core/server/saved_objects/service/lib/decorate_opensearch_error.ts index c2b6f521d6cc..c28c2f5111c2 100644 --- a/src/core/server/saved_objects/service/lib/decorate_opensearch_error.ts +++ b/src/core/server/saved_objects/service/lib/decorate_opensearch_error.ts @@ -30,7 +30,7 @@ * GitHub history for details. */ -import { errors as opensearchErrors } from '@elastic/elasticsearch'; +import { errors as opensearchErrors } from '@opensearch-project/opensearch'; import { get } from 'lodash'; const responseErrors = { diff --git a/src/core/server/saved_objects/service/lib/repository_opensearch_client.ts b/src/core/server/saved_objects/service/lib/repository_opensearch_client.ts index 9a9deefb4ae9..ad422e939a74 100644 --- a/src/core/server/saved_objects/service/lib/repository_opensearch_client.ts +++ b/src/core/server/saved_objects/service/lib/repository_opensearch_client.ts @@ -29,7 +29,7 @@ * Modifications Copyright OpenSearch Contributors. See * GitHub history for details. */ -import type { TransportRequestOptions } from '@elastic/elasticsearch/lib/Transport'; +import type { TransportRequestOptions } from '@opensearch-project/opensearch/lib/Transport'; import { OpenSearchClient } from '../../../opensearch/'; import { retryCallCluster } from '../../../opensearch/client/retry_call_cluster'; diff --git a/src/core/server/server.api.md b/src/core/server/server.api.md index 918b116ee2cf..ea28b2e51648 100644 --- a/src/core/server/server.api.md +++ b/src/core/server/server.api.md @@ -4,7 +4,7 @@ ```ts -import { ApiResponse } from '@elastic/elasticsearch/lib/Transport'; +import { ApiResponse } from '@opensearch-project/opensearch/lib/Transport'; import Boom from '@hapi/boom'; import { BulkIndexDocumentsParams } from 'elasticsearch'; import { CatAliasesParams } from 'elasticsearch'; @@ -23,7 +23,7 @@ import { CatThreadPoolParams } from 'elasticsearch'; import { ClearScrollParams } from 'elasticsearch'; import { CliArgs } from '@osd/config'; import { Client } from 'elasticsearch'; -import { ClientOptions } from '@elastic/elasticsearch'; +import { ClientOptions } from '@opensearch-project/opensearch'; import { ClusterAllocationExplainParams } from 'elasticsearch'; import { ClusterGetSettingsParams } from 'elasticsearch'; import { ClusterHealthParams } from 'elasticsearch'; @@ -100,7 +100,7 @@ import { IngestDeletePipelineParams } from 'elasticsearch'; import { IngestGetPipelineParams } from 'elasticsearch'; import { IngestPutPipelineParams } from 'elasticsearch'; import { IngestSimulateParams } from 'elasticsearch'; -import { KibanaClient } from '@elastic/elasticsearch/api/kibana'; +import { OpenSearchDashboardsClient } from '@opensearch-project/opensearch/api/opensearch_dashboards'; import { Logger } from '@osd/logging'; import { LoggerFactory } from '@osd/logging'; import { LogLevel } from '@osd/logging'; @@ -155,9 +155,9 @@ import { TasksCancelParams } from 'elasticsearch'; import { TasksGetParams } from 'elasticsearch'; import { TasksListParams } from 'elasticsearch'; import { TermvectorsParams } from 'elasticsearch'; -import { TransportRequestOptions } from '@elastic/elasticsearch/lib/Transport'; -import { TransportRequestParams } from '@elastic/elasticsearch/lib/Transport'; -import { TransportRequestPromise } from '@elastic/elasticsearch/lib/Transport'; +import { TransportRequestOptions } from '@opensearch-project/opensearch/lib/Transport'; +import { TransportRequestParams } from '@opensearch-project/opensearch/lib/Transport'; +import { TransportRequestPromise } from '@opensearch-project/opensearch/lib/Transport'; import { Type } from '@osd/config-schema'; import { TypeOf } from '@osd/config-schema'; import { UpdateDocumentByQueryParams } from 'elasticsearch'; @@ -1414,7 +1414,7 @@ export interface OnPreRoutingToolkit { } // @public -export type OpenSearchClient = Omit & { +export type OpenSearchClient = Omit & { transport: { request(params: TransportRequestParams, options?: TransportRequestOptions): TransportRequestPromise; }; diff --git a/src/plugins/data/common/search/opensearch_search/types.ts b/src/plugins/data/common/search/opensearch_search/types.ts index 355a3bf0acf9..45507e4b731e 100644 --- a/src/plugins/data/common/search/opensearch_search/types.ts +++ b/src/plugins/data/common/search/opensearch_search/types.ts @@ -30,7 +30,7 @@ * GitHub history for details. */ import { SearchResponse } from 'elasticsearch'; -import { Search } from '@elastic/elasticsearch/api/requestParams'; +import { Search } from '@opensearch-project/opensearch/api/requestParams'; import { IOpenSearchDashboardsSearchRequest, IOpenSearchDashboardsSearchResponse } from '../types'; export const OPENSEARCH_SEARCH_STRATEGY = 'opensearch'; diff --git a/src/plugins/data/common/search/search_source/legacy/types.ts b/src/plugins/data/common/search/search_source/legacy/types.ts index ccc6d87602e0..34c5b02b3480 100644 --- a/src/plugins/data/common/search/search_source/legacy/types.ts +++ b/src/plugins/data/common/search/search_source/legacy/types.ts @@ -31,7 +31,7 @@ */ import { BehaviorSubject } from 'rxjs'; -import { ApiResponse } from '@elastic/elasticsearch'; +import { ApiResponse } from '@opensearch-project/opensearch'; import { SearchResponse } from 'elasticsearch'; import { FetchHandlers, SearchRequest } from '../fetch'; diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index e726f72c70db..0c805b558063 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -6,8 +6,8 @@ import { $Values } from '@osd/utility-types'; import { Action } from 'history'; -import { ApiResponse } from '@elastic/elasticsearch'; -import { ApiResponse as ApiResponse_2 } from '@elastic/elasticsearch/lib/Transport'; +import { ApiResponse } from '@opensearch-project/opensearch'; +import { ApiResponse as ApiResponse_2 } from '@opensearch-project/opensearch/lib/Transport'; import { ApplicationStart } from 'opensearch-dashboards/public'; import { Assign } from '@osd/utility-types'; import { BehaviorSubject } from 'rxjs'; @@ -35,7 +35,7 @@ import { ISearchOptions as ISearchOptions_2 } from 'src/plugins/data/public'; import { ISearchSource as ISearchSource_2 } from 'src/plugins/data/public'; import { IStorageWrapper } from 'src/plugins/opensearch_dashboards_utils/public'; import { IUiSettingsClient } from 'src/core/public'; -import { KibanaClient } from '@elastic/elasticsearch/api/kibana'; +import { OpenSearchDashboardsClient } from '@opensearch-project/opensearch/api/opensearch_dashboards'; import { Location } from 'history'; import { LocationDescriptorObject } from 'history'; import { Logger } from '@osd/logging'; @@ -66,14 +66,14 @@ import { SavedObject } from 'src/core/server'; import { SavedObject as SavedObject_2 } from 'src/core/public'; import { SavedObjectReference as SavedObjectReference_2 } from 'src/core/types'; import { SavedObjectsClientContract } from 'src/core/public'; -import { Search } from '@elastic/elasticsearch/api/requestParams'; +import { Search } from '@opensearch-project/opensearch/api/requestParams'; import { SearchResponse } from 'elasticsearch'; import { SerializedFieldFormat as SerializedFieldFormat_2 } from 'src/plugins/expressions/common'; import { ToastInputFields } from 'src/core/public/notifications'; import { ToastsSetup } from 'opensearch-dashboards/public'; -import { TransportRequestOptions } from '@elastic/elasticsearch/lib/Transport'; -import { TransportRequestParams } from '@elastic/elasticsearch/lib/Transport'; -import { TransportRequestPromise } from '@elastic/elasticsearch/lib/Transport'; +import { TransportRequestOptions } from '@opensearch-project/opensearch/lib/Transport'; +import { TransportRequestParams } from '@opensearch-project/opensearch/lib/Transport'; +import { TransportRequestPromise } from '@opensearch-project/opensearch/lib/Transport'; import { TypeOf } from '@osd/config-schema'; import { UiActionsSetup } from 'src/plugins/ui_actions/public'; import { UiActionsStart } from 'src/plugins/ui_actions/public'; diff --git a/src/plugins/data/server/search/opensearch_search/opensearch_search_strategy.ts b/src/plugins/data/server/search/opensearch_search/opensearch_search_strategy.ts index 852742abb989..1c0891b11209 100644 --- a/src/plugins/data/server/search/opensearch_search/opensearch_search_strategy.ts +++ b/src/plugins/data/server/search/opensearch_search/opensearch_search_strategy.ts @@ -33,7 +33,7 @@ import { first } from 'rxjs/operators'; import { SharedGlobalConfig, Logger } from 'opensearch-dashboards/server'; import { SearchResponse } from 'elasticsearch'; import { Observable } from 'rxjs'; -import { ApiResponse } from '@elastic/elasticsearch'; +import { ApiResponse } from '@opensearch-project/opensearch'; import { SearchUsage } from '../collectors/usage'; import { toSnakeCase } from './to_snake_case'; import { diff --git a/src/plugins/data/server/search/opensearch_search/shim_abort_signal.ts b/src/plugins/data/server/search/opensearch_search/shim_abort_signal.ts index b35b29c7147e..cc35986fe37a 100644 --- a/src/plugins/data/server/search/opensearch_search/shim_abort_signal.ts +++ b/src/plugins/data/server/search/opensearch_search/shim_abort_signal.ts @@ -30,7 +30,7 @@ * GitHub history for details. */ -import { TransportRequestPromise } from '@elastic/elasticsearch/lib/Transport'; +import { TransportRequestPromise } from '@opensearch-project/opensearch/lib/Transport'; /** * diff --git a/src/plugins/data/server/search/routes/call_msearch.ts b/src/plugins/data/server/search/routes/call_msearch.ts index 19797f7f0272..06cdee7a0730 100644 --- a/src/plugins/data/server/search/routes/call_msearch.ts +++ b/src/plugins/data/server/search/routes/call_msearch.ts @@ -32,7 +32,7 @@ import { Observable } from 'rxjs'; import { first } from 'rxjs/operators'; -import { ApiResponse } from '@elastic/elasticsearch'; +import { ApiResponse } from '@opensearch-project/opensearch'; import { SearchResponse } from 'elasticsearch'; import { IUiSettingsClient, IScopedClusterClient, SharedGlobalConfig } from 'src/core/server'; diff --git a/src/plugins/data/server/server.api.md b/src/plugins/data/server/server.api.md index 2c066808b3db..cfa4b319cbfb 100644 --- a/src/plugins/data/server/server.api.md +++ b/src/plugins/data/server/server.api.md @@ -5,7 +5,7 @@ ```ts import { $Values } from '@osd/utility-types'; -import { ApiResponse } from '@elastic/elasticsearch'; +import { ApiResponse } from '@opensearch-project/opensearch'; import { Assign } from '@osd/utility-types'; import { BehaviorSubject } from 'rxjs'; import { ConfigDeprecationProvider } from '@osd/config'; @@ -42,12 +42,12 @@ import { RequestHandlerContext } from 'src/core/server'; import { RequestStatistics } from 'src/plugins/inspector/common'; import { SavedObject } from 'src/core/server'; import { SavedObjectsClientContract } from 'src/core/server'; -import { Search } from '@elastic/elasticsearch/api/requestParams'; +import { Search } from '@opensearch-project/opensearch/api/requestParams'; import { SearchResponse } from 'elasticsearch'; import { SerializedFieldFormat as SerializedFieldFormat_2 } from 'src/plugins/expressions/common'; import { ShardsResponse } from 'elasticsearch'; import { ToastInputFields } from 'src/core/public/notifications'; -import { TransportRequestPromise } from '@elastic/elasticsearch/lib/Transport'; +import { TransportRequestPromise } from '@opensearch-project/opensearch/lib/Transport'; import { Type } from '@osd/config-schema'; import { TypeOf } from '@osd/config-schema'; import { Unit } from '@elastic/datemath'; diff --git a/src/plugins/embeddable/public/public.api.md b/src/plugins/embeddable/public/public.api.md index 4406dded9854..607652e77a4a 100644 --- a/src/plugins/embeddable/public/public.api.md +++ b/src/plugins/embeddable/public/public.api.md @@ -7,8 +7,8 @@ import { Action } from 'history'; import { Action as Action_3 } from 'src/plugins/ui_actions/public'; import { ActionExecutionContext as ActionExecutionContext_2 } from 'src/plugins/ui_actions/public'; -import { ApiResponse } from '@elastic/elasticsearch/lib/Transport'; -import { ApiResponse as ApiResponse_2 } from '@elastic/elasticsearch'; +import { ApiResponse } from '@opensearch-project/opensearch/lib/Transport'; +import { ApiResponse as ApiResponse_2 } from '@opensearch-project/opensearch'; import { ApplicationStart as ApplicationStart_2 } from 'kibana/public'; import { Assign } from '@kbn/utility-types'; import { BehaviorSubject } from 'rxjs'; @@ -38,7 +38,7 @@ import { ISearchOptions } from 'src/plugins/data/public'; import { ISearchSource } from 'src/plugins/data/public'; import { IStorageWrapper } from 'src/plugins/kibana_utils/public'; import { IUiSettingsClient as IUiSettingsClient_2 } from 'src/core/public'; -import { KibanaClient } from '@elastic/elasticsearch/api/kibana'; +import { OpenSearchDashboardsClient } from '@opensearch-project/opensearch/api/opensearch_dashboards'; import { KibanaConfigType } from 'src/core/server/kibana_config'; import { Location } from 'history'; import { LocationDescriptorObject } from 'history'; @@ -67,7 +67,7 @@ import { SavedObjectAttributes } from 'kibana/server'; import { SavedObjectAttributes as SavedObjectAttributes_2 } from 'src/core/public'; import { SavedObjectAttributes as SavedObjectAttributes_3 } from 'kibana/public'; import { SavedObjectsClientContract as SavedObjectsClientContract_3 } from 'src/core/public'; -import { Search } from '@elastic/elasticsearch/api/requestParams'; +import { Search } from '@opensearch-project/opensearch/api/requestParams'; import { SearchResponse } from 'elasticsearch'; import { SerializedFieldFormat as SerializedFieldFormat_2 } from 'src/plugins/expressions/common'; import { ShallowPromise } from '@kbn/utility-types'; @@ -75,9 +75,9 @@ import { SimpleSavedObject as SimpleSavedObject_2 } from 'src/core/public'; import { Start as Start_2 } from 'src/plugins/inspector/public'; import { ToastInputFields as ToastInputFields_2 } from 'src/core/public/notifications'; import { ToastsSetup as ToastsSetup_2 } from 'kibana/public'; -import { TransportRequestOptions } from '@elastic/elasticsearch/lib/Transport'; -import { TransportRequestParams } from '@elastic/elasticsearch/lib/Transport'; -import { TransportRequestPromise } from '@elastic/elasticsearch/lib/Transport'; +import { TransportRequestOptions } from '@opensearch-project/opensearch/lib/Transport'; +import { TransportRequestParams } from '@opensearch-project/opensearch/lib/Transport'; +import { TransportRequestPromise } from '@opensearch-project/opensearch/lib/Transport'; import { TypeOf } from '@kbn/config-schema'; import { UiComponent } from 'src/plugins/kibana_utils/public'; import { UnregisterCallback } from 'history'; diff --git a/test/common/services/opensearch.ts b/test/common/services/opensearch.ts index dbf287e63747..de7b03172d9b 100644 --- a/test/common/services/opensearch.ts +++ b/test/common/services/opensearch.ts @@ -32,7 +32,7 @@ import { format as formatUrl } from 'url'; import fs from 'fs'; -import { Client } from '@elastic/elasticsearch'; +import { Client } from '@opensearch-project/opensearch'; import { CA_CERT_PATH } from '@osd/dev-utils'; import { FtrProviderContext } from '../ftr_provider_context'; diff --git a/yarn.lock b/yarn.lock index 1ac25349a521..cb3bf2bc43a2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1225,18 +1225,6 @@ dependencies: tslib "^1.9.3" -"@elastic/elasticsearch@7.10.0-rc.1": - version "7.10.0-rc.1" - resolved "https://registry.yarnpkg.com/@elastic/elasticsearch/-/elasticsearch-7.10.0-rc.1.tgz#c23fc5cbfdb40cf2ce6f9cd796b75940e8c9dc8a" - integrity sha512-STaBlEwYbT8yT3HJ+mbO1kx+Kb7Ft7Q0xG5GxZbqbAJ7PZvgGgJWwN7jUg4oKJHbTfxV3lPvFa+PaUK2TqGuYg== - dependencies: - debug "^4.1.1" - decompress-response "^4.2.0" - hpagent "^0.1.1" - ms "^2.1.1" - pump "^3.0.0" - secure-json-parse "^2.1.0" - "@elastic/ems-client@7.10.0": version "7.10.0" resolved "https://registry.yarnpkg.com/@elastic/ems-client/-/ems-client-7.10.0.tgz#6d0e12ce99acd122d8066aa0a8685ecfd21637d3" @@ -2752,6 +2740,16 @@ dependencies: "@octokit/openapi-types" "^7.2.3" +"@opensearch-project/opensearch@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@opensearch-project/opensearch/-/opensearch-1.0.2.tgz#b5946bcd2b6b655b4ae8fbb4562411cf283a7503" + integrity sha512-gQ2CjbS7/pJ4A3IBWd+AD0KbCaAnE1Ur9baRxqM1NMH/7A8GQxwtVxx8raUOf4HZExkZZOUYBMzJgWM1OyELyw== + dependencies: + debug "^4.3.1" + hpagent "^0.1.1" + ms "^2.1.3" + secure-json-parse "^2.4.0" + "@percy/agent@^0.28.6": version "0.28.6" resolved "https://registry.yarnpkg.com/@percy/agent/-/agent-0.28.6.tgz#b220fab6ddcf63ae4e6c343108ba6955a772ce1c" @@ -8981,6 +8979,13 @@ debug@^4: dependencies: ms "2.1.2" +debug@^4.3.1: + version "4.3.3" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.3.tgz#04266e0b70a98d4462e6e288e38259213332b664" + integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q== + dependencies: + ms "2.1.2" + debuglog@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" @@ -9016,13 +9021,6 @@ decompress-response@^3.2.0, decompress-response@^3.3.0: dependencies: mimic-response "^1.0.0" -decompress-response@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-4.2.0.tgz#805ca9d1d3cdf17a03951475ad6cdc93115cec3f" - integrity sha512-MHebOkORCgLW1ramLri5vzfR4r7HgXXrVkVr/eaPVRCtYWFUp9hNAuqsBxhpABbpqd7zY2IrjxXfTuaVrW0Z2A== - dependencies: - mimic-response "^2.0.0" - decompress-response@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-6.0.0.tgz#ca387612ddb7e104bd16d85aab00d5ecf09c66fc" @@ -17099,11 +17097,6 @@ mimic-response@^1.0.0, mimic-response@^1.0.1: resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ== -mimic-response@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-2.1.0.tgz#d13763d35f613d09ec37ebb30bac0469c0ee8f43" - integrity sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA== - mimic-response@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-3.1.0.tgz#2d1d59af9c1b129815accc2c46a022a5ce1fa3c9" @@ -17372,6 +17365,11 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== +ms@^2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + msgpackr-extract@^1.0.14: version "1.0.15" resolved "https://registry.yarnpkg.com/msgpackr-extract/-/msgpackr-extract-1.0.15.tgz#3010a3ff0b033782d525116071b6c32864a79db2" @@ -21626,10 +21624,10 @@ scss-tokenizer@^0.2.3: js-base64 "^2.1.8" source-map "^0.4.2" -secure-json-parse@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/secure-json-parse/-/secure-json-parse-2.1.0.tgz#ae76f5624256b5c497af887090a5d9e156c9fb20" - integrity sha512-GckO+MS/wT4UogDyoI/H/S1L0MCcKS1XX/vp48wfmU7Nw4woBmb8mIpu4zPBQjKlRT88/bt9xdoV4111jPpNJA== +secure-json-parse@^2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/secure-json-parse/-/secure-json-parse-2.4.0.tgz#5aaeaaef85c7a417f76271a4f5b0cc3315ddca85" + integrity sha512-Q5Z/97nbON5t/L/sH6mY2EacfjVGwrCcSi5D3btRO2GZ8pf1K1UN7Z9H5J57hjVU2Qzxr1xO+FmBhOvEkzCMmg== select-hose@^2.0.0: version "2.0.0"