Skip to content
Merged
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
146 changes: 99 additions & 47 deletions src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}/`;
Expand All @@ -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`,
Expand Down Expand Up @@ -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`,
Expand Down Expand Up @@ -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`,
Expand Down Expand Up @@ -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`,
},
Expand All @@ -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`,
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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`,
Expand All @@ -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`,
Expand Down Expand Up @@ -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`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/',
};
};
2 changes: 1 addition & 1 deletion src/platform/packages/shared/kbn-doc-links/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface DocLinksMeta {
elasticGithubUrl: string;
docsWebsiteUrl: string;
searchLabsUrl: string;
apiDocsUrl: string;
}

/**
Expand Down Expand Up @@ -381,7 +382,6 @@ export interface DocLinks {
simulatePipeline: string;
tasks: string;
timeUnits: string;
unfreezeIndex: string;
updateTransform: string;
}>;
readonly observability: Readonly<{
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,12 @@ describe('<IndexDetailsPage />', () => {
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 () => {
Expand Down