diff --git a/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts b/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts index 52fdb6f47ed64..a56839a548a18 100644 --- a/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts +++ b/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts @@ -25,9 +25,14 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D const DOCS_WEBSITE_URL = meta.docsWebsiteUrl; const ELASTIC_GITHUB = meta.elasticGithubUrl; const SEARCH_LABS_URL = meta.searchLabsUrl; + const API_DOCS = meta.apiDocsUrl; const ELASTICSEARCH_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}/`; + const ELASTICSEARCH_APIS = `${API_DOCS}doc/elasticsearch/v8/`; + const ELASTICSEARCH_SERVERLESS_APIS = `${API_DOCS}doc/elasticsearch-serverless/`; const KIBANA_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/`; + const KIBANA_APIS = `${API_DOCS}doc/kibana/v8/`; + const KIBANA_SERVERLESS_APIS = `{$API_DOCS}doc/serverless/`; const FLEET_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/fleet/${DOC_LINK_VERSION}/`; const INTEGRATIONS_DEV_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/integrations-developer/current/`; const PLUGIN_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/plugins/${DOC_LINK_VERSION}/`; @@ -159,7 +164,9 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D behavioralAnalyticsCORS: `${ELASTICSEARCH_DOCS}behavioral-analytics-cors.html`, behavioralAnalyticsEvents: `${ELASTICSEARCH_DOCS}behavioral-analytics-event.html`, buildConnector: `${ELASTICSEARCH_DOCS}es-build-connector.html`, - bulkApi: `${ELASTICSEARCH_DOCS}docs-bulk.html`, + bulkApi: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-bulk` + : `${ELASTICSEARCH_APIS}operation/operation-bulk`, configuration: `${ENTERPRISE_SEARCH_DOCS}configuration.html`, connectors: `${ELASTICSEARCH_DOCS}es-connectors.html`, connectorsClientDeploy: `${ELASTICSEARCH_DOCS}es-build-connector.html#es-connectors-deploy-connector-service`, @@ -202,8 +209,12 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D e5Model: `${MACHINE_LEARNING_DOCS}ml-nlp-e5.html`, elser: `${ELASTICSEARCH_DOCS}semantic-search-semantic-text.html`, engines: `${ENTERPRISE_SEARCH_DOCS}engines.html`, - indexApi: `${ELASTICSEARCH_DOCS}docs-index_.html`, - inferenceApiCreate: `${ELASTICSEARCH_DOCS}put-inference-api.html`, + indexApi: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-create` + : `${ELASTICSEARCH_APIS}operation/operation-create`, + inferenceApiCreate: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-inference-put` + : `${ELASTICSEARCH_APIS}operation/operation-inference-put`, ingestionApis: `${ELASTICSEARCH_DOCS}search-with-elasticsearch.html`, ingestPipelines: `${ELASTICSEARCH_DOCS}ingest-pipeline-search.html`, knnSearch: `${ELASTICSEARCH_DOCS}knn-search.html`, @@ -362,7 +373,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D autocompleteSuggestions: `${KIBANA_DOCS}kibana-concepts-analysts.html#autocomplete-suggestions`, secureSavedObject: `${KIBANA_DOCS}xpack-security-secure-saved-objects.html`, xpackSecurity: `${KIBANA_DOCS}xpack-security.html`, - restApis: `${KIBANA_DOCS}api.html`, + restApis: isServerless ? `${KIBANA_SERVERLESS_APIS}` : `${KIBANA_APIS}`, dashboardImportExport: `${KIBANA_DOCS}dashboard-api.html`, legacyOpenSslProvider: `${KIBANA_DOCS}production.html#openssl-legacy-provider`, }, @@ -371,7 +382,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D batchReindex: `${KIBANA_DOCS}batch-start-resume-reindex.html`, indexBlocks: `${ELASTICSEARCH_DOCS}index-modules-blocks.html#index-block-settings`, remoteReindex: `${ELASTICSEARCH_DOCS}docs-reindex.html#reindex-from-remote`, - unfreezeApi: `${ELASTICSEARCH_DOCS}unfreeze-index-api.html`, + unfreezeApi: `${ELASTICSEARCH_DOCS}/unfreeze-index-api.html`, reindexWithPipeline: `${ELASTICSEARCH_DOCS}docs-reindex.html#reindex-with-an-ingest-pipeline`, logsDatastream: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}/logs-data-stream.html`, usingLogsDbIndexModeWithESSecurity: `${ELASTIC_WEBSITE_URL}guide/en/security/${DOC_LINK_VERSION}/detections-logsdb-index-mode-impact.html`, @@ -564,7 +575,9 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D visualizationSettings: `${KIBANA_DOCS}advanced-options.html#kibana-visualization-settings`, timelionSettings: `${KIBANA_DOCS}advanced-options.html#kibana-timelion-settings`, generalSettings: `${KIBANA_DOCS}advanced-options.html#kibana-general-settings`, - savedObjectsApiList: `${KIBANA_DOCS}saved-objects-api.html#saved-objects-api`, + savedObjectsApiList: isServerless + ? `${KIBANA_SERVERLESS_APIS}group/endpoint-saved-objects` + : `${KIBANA_APIS}group/endpoint-saved-objects`, apiKeys: `${KIBANA_DOCS}api-keys.html`, }, ml: { @@ -773,41 +786,78 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D skippingDisconnectedClusters: `${ELASTICSEARCH_DOCS}modules-cross-cluster-search.html#skip-unavailable-clusters`, }, apis: { - bulkIndexAlias: `${ELASTICSEARCH_DOCS}indices-aliases.html`, - indexStats: `${ELASTICSEARCH_DOCS}indices-stats.html`, + bulkIndexAlias: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-indices-update-aliases` + : `${ELASTICSEARCH_APIS}operation/operation-indices-update-aliases`, + indexStats: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-indices-update-aliases` + : `${ELASTICSEARCH_APIS}operation/operation-indices-stats`, byteSizeUnits: `${ELASTICSEARCH_DOCS}api-conventions.html#byte-units`, - createAutoFollowPattern: `${ELASTICSEARCH_DOCS}ccr-put-auto-follow-pattern.html`, - createFollower: `${ELASTICSEARCH_DOCS}ccr-put-follow.html`, - createIndex: `${ELASTICSEARCH_DOCS}indices-create-index.html`, - createSnapshotLifecyclePolicy: `${ELASTICSEARCH_DOCS}slm-api-put-policy.html`, - createRoleMapping: `${ELASTICSEARCH_DOCS}security-api-put-role-mapping.html`, - createRoleMappingTemplates: `${ELASTICSEARCH_DOCS}security-api-put-role-mapping.html#_role_templates`, - createRollupJobsRequest: `${ELASTICSEARCH_DOCS}rollup-put-job.html#rollup-put-job-api-request-body`, - createApiKey: `${ELASTICSEARCH_DOCS}security-api-create-api-key.html`, - createPipeline: `${ELASTICSEARCH_DOCS}put-pipeline-api.html`, - createTransformRequest: `${ELASTICSEARCH_DOCS}put-transform.html#put-transform-request-body`, + createAutoFollowPattern: `${ELASTICSEARCH_APIS}operation/operation-ccr-put-auto-follow-pattern`, + createFollower: `${ELASTICSEARCH_APIS}operation/operation-ccr-follow`, + createIndex: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-indices-create` + : `${ELASTICSEARCH_APIS}operation/operation-indices-create`, + createSnapshotLifecyclePolicy: `${ELASTICSEARCH_APIS}operation/operation-slm-put-lifecycle`, + createRoleMapping: `${ELASTICSEARCH_APIS}operation/operation-security-put-role-mapping`, + createRoleMappingTemplates: `${ELASTICSEARCH_APIS}operation/operation-security-put-role-mapping`, + createRollupJobsRequest: `${ELASTICSEARCH_APIS}operation/operation-rollup-put-job#operation-rollup-put-job-body-application-json`, + createApiKey: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-security-create-api-key` + : `${ELASTICSEARCH_APIS}operation/operation-security-create-api-key`, + createPipeline: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-ingest-put-pipeline` + : `${ELASTICSEARCH_APIS}operation/operation-ingest-put-pipeline`, + createTransformRequest: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-transform-put-transform` + : `${ELASTICSEARCH_APIS}operation/operation-transform-put-transform`, cronExpressions: `${ELASTICSEARCH_DOCS}cron-expressions.html`, - executeWatchActionModes: `${ELASTICSEARCH_DOCS}watcher-api-execute-watch.html#watcher-api-execute-watch-action-mode`, - indexExists: `${ELASTICSEARCH_DOCS}indices-exists.html`, - inferTrainedModel: `${ELASTICSEARCH_DOCS}infer-trained-model.html`, - multiSearch: `${ELASTICSEARCH_DOCS}search-multi-search.html`, - openIndex: `${ELASTICSEARCH_DOCS}indices-open-close.html`, - putComponentTemplate: `${ELASTICSEARCH_DOCS}indices-component-template.html`, - painlessExecute: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/painless/${DOC_LINK_VERSION}/painless-execute-api.html`, - painlessExecuteAPIContexts: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/painless/${DOC_LINK_VERSION}/painless-execute-api.html#_contexts`, - putComponentTemplateMetadata: `${ELASTICSEARCH_DOCS}indices-component-template.html#component-templates-metadata`, - putEnrichPolicy: `${ELASTICSEARCH_DOCS}put-enrich-policy-api.html`, - putIndexTemplateV1: `${ELASTICSEARCH_DOCS}indices-templates-v1.html`, - putSnapshotLifecyclePolicy: `${ELASTICSEARCH_DOCS}slm-api-put-policy.html`, - putWatch: `${ELASTICSEARCH_DOCS}watcher-api-put-watch.html`, - restApis: `${ELASTICSEARCH_DOCS}rest-apis.html`, - searchPreference: `${ELASTICSEARCH_DOCS}search-search.html#search-preference`, - securityApis: `${ELASTICSEARCH_DOCS}security-api.html`, - simulatePipeline: `${ELASTICSEARCH_DOCS}simulate-pipeline-api.html`, - tasks: `${ELASTICSEARCH_DOCS}tasks.html`, + executeWatchActionModes: `${ELASTICSEARCH_APIS}operation/operation-watcher-execute-watch#operation-watcher-execute-watch-body-application-json`, + indexExists: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-indices-exists` + : `${ELASTICSEARCH_APIS}operation/operation-indices-exists`, + inferTrainedModel: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-ml-infer-trained-model` + : `${ELASTICSEARCH_APIS}operation/operation-ml-infer-trained-model`, + multiSearch: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-msearch` + : `${ELASTICSEARCH_APIS}operation/operation-msearch`, + openIndex: `${ELASTICSEARCH_APIS}operation/operation-indices-open`, + putComponentTemplate: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-cluster-put-component-template` + : `${ELASTICSEARCH_APIS}operation/operation-cluster-put-component-template`, + painlessExecute: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-scripts-painless-execute` + : `${ELASTICSEARCH_APIS}operation/operation-scripts-painless-execute`, + painlessExecuteAPIContexts: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-scripts-painless-execute#operation-scripts-painless-execute-body-application-json` + : `${ELASTICSEARCH_APIS}operation/operation-scripts-painless-execute#operation-scripts-painless-execute-body-application-json`, + putComponentTemplateMetadata: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-cluster-put-component-template#operation-cluster-put-component-template-body-application-json-_meta` + : `${ELASTICSEARCH_APIS}operation/operation-cluster-put-component-template#operation-cluster-put-component-template-body-application-json-_meta`, + putEnrichPolicy: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-enrich-put-policy` + : `${ELASTICSEARCH_APIS}operation/operation-enrich-put-policy`, + putIndexTemplateV1: `${ELASTICSEARCH_APIS}operation/operation-indices-put-template`, + putSnapshotLifecyclePolicy: `${ELASTICSEARCH_APIS}operation/operation-slm-put-lifecycle`, + putWatch: `${ELASTICSEARCH_APIS}operation/operation-watcher-put-watch`, + restApis: isServerless ? `${ELASTICSEARCH_SERVERLESS_APIS}` : `${ELASTICSEARCH_APIS}`, + searchPreference: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-search#operation-search-preference` + : `${ELASTICSEARCH_APIS}operation/operation-search#operation-search-preference`, + securityApis: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}group/endpoint-security` + : `${ELASTICSEARCH_APIS}group/endpoint-security`, + simulatePipeline: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-ingest-simulate` + : `${ELASTICSEARCH_APIS}operation/operation-ingest-simulate`, + tasks: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}group/endpoint-tasks` + : `${ELASTICSEARCH_APIS}group/endpoint-tasks`, timeUnits: `${ELASTICSEARCH_DOCS}api-conventions.html#time-units`, - unfreezeIndex: `${ELASTICSEARCH_DOCS}unfreeze-index-api.html`, - updateTransform: `${ELASTICSEARCH_DOCS}update-transform.html`, + updateTransform: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-transform-update-transform` + : `${ELASTICSEARCH_APIS}operation/operation-transform-update-transform`, }, plugins: { azureRepo: `${ELASTICSEARCH_DOCS}repository-azure.html`, @@ -822,14 +872,14 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D guide: `${ELASTICSEARCH_DOCS}snapshot-restore.html`, changeIndexSettings: `${ELASTICSEARCH_DOCS}index-modules.html`, createSnapshot: `${ELASTICSEARCH_DOCS}snapshots-take-snapshot.html`, - getSnapshot: `${ELASTICSEARCH_DOCS}get-snapshot-api.html`, + getSnapshot: `${ELASTICSEARCH_APIS}operation/operation-snapshot-get`, registerSharedFileSystem: `${ELASTICSEARCH_DOCS}snapshots-filesystem-repository.html#filesystem-repository-settings`, registerSourceOnly: `${ELASTICSEARCH_DOCS}snapshots-source-only-repository.html#source-only-repository-settings`, registerUrl: `${ELASTICSEARCH_DOCS}snapshots-read-only-repository.html#read-only-url-repository-settings`, restoreSnapshot: `${ELASTICSEARCH_DOCS}snapshots-restore-snapshot.html`, - restoreSnapshotApi: `${ELASTICSEARCH_DOCS}restore-snapshot-api.html#restore-snapshot-api-request-body`, + restoreSnapshotApi: `${ELASTICSEARCH_APIS}operation/operation-snapshot-restore`, searchableSnapshotSharedCache: `${ELASTICSEARCH_DOCS}searchable-snapshots.html#searchable-snapshots-shared-cache`, - slmStart: `${ELASTICSEARCH_DOCS}slm-api-start.html`, + slmStart: `${ELASTICSEARCH_APIS}operation/operation-slm-start`, }, ingest: { append: `${ELASTICSEARCH_DOCS}append-processor.html`, @@ -1041,7 +1091,9 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D hiddenFields: `${KIBANA_DOCS}playground-query.html#playground-hidden-fields`, }, inferenceManagement: { - inferenceAPIDocumentation: `${ELASTIC_WEBSITE_URL}docs/api/doc/elasticsearch/operation/operation-inference-put`, + inferenceAPIDocumentation: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-inference-put` + : `${ELASTICSEARCH_APIS}operation/operation-inference-put`, }, cases: { legacyApiDeprecations: `${KIBANA_DOCS}breaking-changes-summary.html#breaking-201004`, diff --git a/src/platform/packages/shared/kbn-doc-links/src/get_doc_meta.ts b/src/platform/packages/shared/kbn-doc-links/src/get_doc_meta.ts index 4a8779567b73c..a0acc9c7533bf 100644 --- a/src/platform/packages/shared/kbn-doc-links/src/get_doc_meta.ts +++ b/src/platform/packages/shared/kbn-doc-links/src/get_doc_meta.ts @@ -25,5 +25,6 @@ export const getDocLinksMeta = ({ elasticGithubUrl: 'https://github.com/elastic/', docsWebsiteUrl: 'https://docs.elastic.co/', searchLabsUrl: 'https://search-labs.elastic.co/', + apiDocsUrl: 'https://www.elastic.co/docs/api/', }; }; diff --git a/src/platform/packages/shared/kbn-doc-links/src/types.ts b/src/platform/packages/shared/kbn-doc-links/src/types.ts index 90668d4412222..508a9f4dd178d 100644 --- a/src/platform/packages/shared/kbn-doc-links/src/types.ts +++ b/src/platform/packages/shared/kbn-doc-links/src/types.ts @@ -17,6 +17,7 @@ export interface DocLinksMeta { elasticGithubUrl: string; docsWebsiteUrl: string; searchLabsUrl: string; + apiDocsUrl: string; } /** @@ -445,7 +446,6 @@ export interface DocLinks { simulatePipeline: string; tasks: string; timeUnits: string; - unfreezeIndex: string; updateTransform: string; }>; readonly observability: Readonly<{ diff --git a/src/platform/plugins/shared/saved_objects_management/public/management_section/object_view/components/__snapshots__/not_found_errors.test.tsx.snap b/src/platform/plugins/shared/saved_objects_management/public/management_section/object_view/components/__snapshots__/not_found_errors.test.tsx.snap index 6e96c51be7be3..561bcf7dd188d 100644 --- a/src/platform/plugins/shared/saved_objects_management/public/management_section/object_view/components/__snapshots__/not_found_errors.test.tsx.snap +++ b/src/platform/plugins/shared/saved_objects_management/public/management_section/object_view/components/__snapshots__/not_found_errors.test.tsx.snap @@ -29,7 +29,7 @@ exports[`NotFoundErrors component renders correctly for index-pattern type 1`] = @@ -80,7 +80,7 @@ exports[`NotFoundErrors component renders correctly for index-pattern-field type @@ -131,7 +131,7 @@ exports[`NotFoundErrors component renders correctly for search type 1`] = ` @@ -180,7 +180,7 @@ exports[`NotFoundErrors component renders correctly for unknown type 1`] = ` diff --git a/x-pack/platform/plugins/shared/index_management/__jest__/client_integration/index_details_page/index_details_page.test.tsx b/x-pack/platform/plugins/shared/index_management/__jest__/client_integration/index_details_page/index_details_page.test.tsx index b98fe8c442bb1..e2034ff0a4c82 100644 --- a/x-pack/platform/plugins/shared/index_management/__jest__/client_integration/index_details_page/index_details_page.test.tsx +++ b/x-pack/platform/plugins/shared/index_management/__jest__/client_integration/index_details_page/index_details_page.test.tsx @@ -222,13 +222,12 @@ describe('', () => { expect(tabContent).toEqual(JSON.stringify(testIndexStats, null, 2)); }); - it('sets the docs link href from the documenation service', async () => { + it('sets the docs link href from the documentation service', async () => { await testBed.actions.clickIndexDetailsTab(IndexDetailsSection.Stats); const docsLinkHref = testBed.actions.stats.getDocsLinkHref(); - // the url from the mocked docs mock - expect(docsLinkHref).toEqual( - 'https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/indices-stats.html' - ); + + expect(docsLinkHref).toMatch(/^https:\/\/www\.elastic\.co\//); + expect(docsLinkHref).toContain('indices-stats'); }); it('renders a warning message if an index is not open', async () => {