diff --git a/CHANGELOG.md b/CHANGELOG.md index 545ee8110c8c..3a4401cc7b1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Add resource ID filtering in fetch `augment-vis` obj queries ([#4608](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4608)) - Reduce the amount of comments in compiled CSS ([#4648](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4648)) - [Saved Object Service] Customize saved objects service status ([#4696](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4696)) +- Remove minimum constraint on opensearch hosts to allow empty host ([#4701](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4701)) - [Discover] Update styles to compatible with OUI `next` theme ([#4644](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4644)) - Remove visualization editor sidebar background ([#4719](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4719)) - [Vis Colors] Remove customized colors from sample visualizations and dashboards ([#4741](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4741)) diff --git a/src/core/server/opensearch/client/cluster_client.ts b/src/core/server/opensearch/client/cluster_client.ts index b29eea89d4db..ac2348921658 100644 --- a/src/core/server/opensearch/client/cluster_client.ts +++ b/src/core/server/opensearch/client/cluster_client.ts @@ -101,7 +101,7 @@ export class ClusterClient implements ICustomClusterClient { return; } this.isClosed = true; - await Promise.all([this.asInternalUser.close(), this.rootScopedClient.close()]); + await Promise.all([this.asInternalUser.close(noop), this.rootScopedClient.close(noop)]); } private getScopedHeaders(request: ScopeableRequest): Headers { diff --git a/src/core/server/opensearch/opensearch_config.ts b/src/core/server/opensearch/opensearch_config.ts index fee26c354fbe..7ef3a7665a97 100644 --- a/src/core/server/opensearch/opensearch_config.ts +++ b/src/core/server/opensearch/opensearch_config.ts @@ -53,7 +53,7 @@ export const configSchema = schema.object({ defaultValue: false, }), sniffOnConnectionFault: schema.boolean({ defaultValue: false }), - hosts: schema.oneOf([hostURISchema, schema.arrayOf(hostURISchema, { minSize: 1 })], { + hosts: schema.oneOf([hostURISchema, schema.arrayOf(hostURISchema)], { defaultValue: 'http://localhost:9200', }), username: schema.maybe( diff --git a/src/core/server/opensearch/opensearch_service.ts b/src/core/server/opensearch/opensearch_service.ts index 87a2da974ba1..bab3e7ede9f3 100644 --- a/src/core/server/opensearch/opensearch_service.ts +++ b/src/core/server/opensearch/opensearch_service.ts @@ -28,7 +28,7 @@ * under the License. */ -import { Observable, Subject } from 'rxjs'; +import { Observable, Subject, of } from 'rxjs'; import { first, map, shareReplay, takeUntil } from 'rxjs/operators'; import { merge } from '@osd/std'; @@ -91,14 +91,26 @@ export class OpenSearchService this.legacyClient = this.createLegacyClusterClient('data', config); this.client = this.createClusterClient('data', config); - const opensearchNodesCompatibility$ = pollOpenSearchNodesVersion({ - internalClient: this.client.asInternalUser, - optimizedHealthcheck: config.optimizedHealthcheck, - log: this.log, - ignoreVersionMismatch: config.ignoreVersionMismatch, - opensearchVersionCheckInterval: config.healthCheckDelay.asMilliseconds(), - opensearchDashboardsVersion: this.opensearchDashboardsVersion, - }).pipe(takeUntil(this.stop$), shareReplay({ refCount: true, bufferSize: 1 })); + let opensearchNodesCompatibility$; + if (config.hosts.length > 0) { + opensearchNodesCompatibility$ = pollOpenSearchNodesVersion({ + internalClient: this.client.asInternalUser, + optimizedHealthcheck: config.optimizedHealthcheck, + log: this.log, + ignoreVersionMismatch: config.ignoreVersionMismatch, + opensearchVersionCheckInterval: config.healthCheckDelay.asMilliseconds(), + opensearchDashboardsVersion: this.opensearchDashboardsVersion, + }).pipe(takeUntil(this.stop$), shareReplay({ refCount: true, bufferSize: 1 })); + } else { + this.log.debug(`Opensearch is not configured.`); + opensearchNodesCompatibility$ = of({ + isCompatible: true, + message: 'Opensearch is not configured', + incompatibleNodes: [], + warningNodes: [], + opensearchDashboardsVersion: this.opensearchDashboardsVersion, + }); + } this.createLegacyCustomClient = (type, clientConfig = {}) => { const finalConfig = merge({}, config, clientConfig); diff --git a/src/core/server/opensearch/status.ts b/src/core/server/opensearch/status.ts index 6b5d2741b405..1a0be8d593b1 100644 --- a/src/core/server/opensearch/status.ts +++ b/src/core/server/opensearch/status.ts @@ -77,7 +77,7 @@ export const calculateStatus$ = ( return { level: ServiceStatusLevels.available, - summary: `OpenSearch is available`, + summary: message ?? `OpenSearch is available`, meta: { warningNodes: [], incompatibleNodes: [],