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 610ee56bb86df..5fb8e87cac570 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 @@ -24,10 +24,15 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D const ELASTIC_WEBSITE_URL = meta.elasticWebsiteUrl; const ELASTIC_GITHUB = meta.elasticGithubUrl; const SEARCH_LABS_URL = meta.searchLabsUrl; + const API_DOCS = meta.apiDocsUrl; const ELASTIC_DOCS = meta.docsWebsiteUrl; const ELASTICSEARCH_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}/`; + const ELASTICSEARCH_APIS = `${API_DOCS}doc/elasticsearch/`; + 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/`; + 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}/`; @@ -46,7 +51,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D elasticStackGetStarted: isServerless ? `${ELASTIC_DOCS}deploy-manage/deploy/elastic-cloud/serverless` : `${ELASTIC_DOCS}get-started`, - apiReference: `${ELASTIC_DOCS}apis`, + apiReference: `${API_DOCS}`, upgrade: { upgradingStackOnPrem: `${ELASTIC_WEBSITE_URL}guide/en/elastic-stack/current/upgrading-elastic-stack-on-prem.html`, upgradingStackOnCloud: `${ELASTIC_WEBSITE_URL}guide/en/elastic-stack/current/upgrade-elastic-stack-for-elastic-cloud.html`, @@ -129,7 +134,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`, @@ -172,9 +179,13 @@ 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`, - inferenceApisConfigureChunking: `${ELASTICSEARCH_DOCS}inference-apis.html#infer-chunking-config`, + 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`, + inferenceApisConfigureChunking: `${ELASTIC_DOCS}explore-analyze/elastic-inference/inference-api#infer-chunking-config`, ingestionApis: `${ELASTICSEARCH_DOCS}search-with-elasticsearch.html`, ingestPipelines: `${ELASTICSEARCH_DOCS}ingest-pipeline-search.html`, knnSearch: `${ELASTICSEARCH_DOCS}knn-search.html`, @@ -296,7 +307,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`, upgradeNotes: `${KIBANA_DOCS}breaking-changes-summary.html`, }, @@ -305,7 +316,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: `https://www.elastic.co/guide/en/elastic-stack/9.0/release-notes-elasticsearch-9.0.0.html#remove_unfreeze_rest_endpoint`, reindexWithPipeline: `${ELASTICSEARCH_DOCS}docs-reindex.html#reindex-with-an-ingest-pipeline`, }, rollupJobs: `${KIBANA_DOCS}data-rollups.html`, @@ -500,7 +511,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: { @@ -693,41 +706,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`, - 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`, - 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`, - timeUnits: `${ELASTICSEARCH_DOCS}api-conventions.html#time-units`, - unfreezeIndex: `${ELASTICSEARCH_DOCS}unfreeze-index-api.html`, - updateTransform: `${ELASTICSEARCH_DOCS}update-transform.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: `${ELASTIC_DOCS}reference/elasticsearch/rest-apis/api-conventions#byte-units`, + 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: `${ELASTIC_DOCS}reference/elasticsearch/rest-apis/api-conventions#api-cron-expressions`, + 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: `${ELASTIC_DOCS}reference/elasticsearch/rest-apis/api-conventions#time-units`, + updateTransform: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-transform-update-transform` + : `${ELASTICSEARCH_APIS}operation/operation-transform-update-transform`, }, plugins: { azureRepo: `${ELASTICSEARCH_DOCS}repository-azure.html`, @@ -742,14 +792,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`, @@ -962,7 +1012,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`, }, synonyms: { synonymsAPIDocumentation: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/current/synonyms-apis.html`, 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 887fe2820c457..80da5190e0cfc 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://www.elastic.co/docs/', 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 8ba8d92f3d3c1..38a4a5591ca06 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; } /** @@ -381,7 +382,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..72d9862c3f9cf 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 9fd2572d356be..b50d6c16647c3 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 () => {