Skip to content

Commit b969cc9

Browse files
lcawlsabarasabajloleysens
authored
Update API URLs in doc link service (#215084)
Co-authored-by: Ignacio Rivas <[email protected]> Co-authored-by: Jean-Louis Leysens <[email protected]>
1 parent c277812 commit b969cc9

File tree

5 files changed

+109
-57
lines changed

5 files changed

+109
-57
lines changed

src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts

Lines changed: 99 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,15 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
2424
const ELASTIC_WEBSITE_URL = meta.elasticWebsiteUrl;
2525
const ELASTIC_GITHUB = meta.elasticGithubUrl;
2626
const SEARCH_LABS_URL = meta.searchLabsUrl;
27+
const API_DOCS = meta.apiDocsUrl;
2728
const ELASTIC_DOCS = meta.docsWebsiteUrl;
2829

2930
const ELASTICSEARCH_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}/`;
31+
const ELASTICSEARCH_APIS = `${API_DOCS}doc/elasticsearch/`;
32+
const ELASTICSEARCH_SERVERLESS_APIS = `${API_DOCS}doc/elasticsearch-serverless/`;
3033
const KIBANA_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/`;
34+
const KIBANA_APIS = `${API_DOCS}doc/kibana/`;
35+
const KIBANA_SERVERLESS_APIS = `{$API_DOCS}doc/serverless/`;
3136
const FLEET_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/fleet/${DOC_LINK_VERSION}/`;
3237
const INTEGRATIONS_DEV_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/integrations-developer/current/`;
3338
const PLUGIN_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/plugins/${DOC_LINK_VERSION}/`;
@@ -46,7 +51,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
4651
elasticStackGetStarted: isServerless
4752
? `${ELASTIC_DOCS}deploy-manage/deploy/elastic-cloud/serverless`
4853
: `${ELASTIC_DOCS}get-started`,
49-
apiReference: `${ELASTIC_DOCS}apis`,
54+
apiReference: `${API_DOCS}`,
5055
upgrade: {
5156
upgradingStackOnPrem: `${ELASTIC_WEBSITE_URL}guide/en/elastic-stack/current/upgrading-elastic-stack-on-prem.html`,
5257
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
129134
behavioralAnalyticsCORS: `${ELASTICSEARCH_DOCS}behavioral-analytics-cors.html`,
130135
behavioralAnalyticsEvents: `${ELASTICSEARCH_DOCS}behavioral-analytics-event.html`,
131136
buildConnector: `${ELASTICSEARCH_DOCS}es-build-connector.html`,
132-
bulkApi: `${ELASTICSEARCH_DOCS}docs-bulk.html`,
137+
bulkApi: isServerless
138+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-bulk`
139+
: `${ELASTICSEARCH_APIS}operation/operation-bulk`,
133140
configuration: `${ENTERPRISE_SEARCH_DOCS}configuration.html`,
134141
connectors: `${ELASTICSEARCH_DOCS}es-connectors.html`,
135142
connectorsClientDeploy: `${ELASTICSEARCH_DOCS}es-build-connector.html#es-connectors-deploy-connector-service`,
@@ -172,9 +179,13 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
172179
e5Model: `${MACHINE_LEARNING_DOCS}ml-nlp-e5.html`,
173180
elser: `${ELASTICSEARCH_DOCS}semantic-search-semantic-text.html`,
174181
engines: `${ENTERPRISE_SEARCH_DOCS}engines.html`,
175-
indexApi: `${ELASTICSEARCH_DOCS}docs-index_.html`,
176-
inferenceApiCreate: `${ELASTICSEARCH_DOCS}put-inference-api.html`,
177-
inferenceApisConfigureChunking: `${ELASTICSEARCH_DOCS}inference-apis.html#infer-chunking-config`,
182+
indexApi: isServerless
183+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-create`
184+
: `${ELASTICSEARCH_APIS}operation/operation-create`,
185+
inferenceApiCreate: isServerless
186+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-inference-put`
187+
: `${ELASTICSEARCH_APIS}operation/operation-inference-put`,
188+
inferenceApisConfigureChunking: `${ELASTIC_DOCS}explore-analyze/elastic-inference/inference-api#infer-chunking-config`,
178189
ingestionApis: `${ELASTICSEARCH_DOCS}search-with-elasticsearch.html`,
179190
ingestPipelines: `${ELASTICSEARCH_DOCS}ingest-pipeline-search.html`,
180191
knnSearch: `${ELASTICSEARCH_DOCS}knn-search.html`,
@@ -296,7 +307,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
296307
autocompleteSuggestions: `${KIBANA_DOCS}kibana-concepts-analysts.html#autocomplete-suggestions`,
297308
secureSavedObject: `${KIBANA_DOCS}xpack-security-secure-saved-objects.html`,
298309
xpackSecurity: `${KIBANA_DOCS}xpack-security.html`,
299-
restApis: `${KIBANA_DOCS}api.html`,
310+
restApis: isServerless ? `${KIBANA_SERVERLESS_APIS}` : `${KIBANA_APIS}`,
300311
dashboardImportExport: `${KIBANA_DOCS}dashboard-api.html`,
301312
upgradeNotes: `${KIBANA_DOCS}breaking-changes-summary.html`,
302313
},
@@ -305,7 +316,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
305316
batchReindex: `${KIBANA_DOCS}batch-start-resume-reindex.html`,
306317
indexBlocks: `${ELASTICSEARCH_DOCS}index-modules-blocks.html#index-block-settings`,
307318
remoteReindex: `${ELASTICSEARCH_DOCS}docs-reindex.html#reindex-from-remote`,
308-
unfreezeApi: `${ELASTICSEARCH_DOCS}unfreeze-index-api.html`,
319+
unfreezeApi: `https://www.elastic.co/guide/en/elastic-stack/9.0/release-notes-elasticsearch-9.0.0.html#remove_unfreeze_rest_endpoint`,
309320
reindexWithPipeline: `${ELASTICSEARCH_DOCS}docs-reindex.html#reindex-with-an-ingest-pipeline`,
310321
},
311322
rollupJobs: `${KIBANA_DOCS}data-rollups.html`,
@@ -500,7 +511,9 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
500511
visualizationSettings: `${KIBANA_DOCS}advanced-options.html#kibana-visualization-settings`,
501512
timelionSettings: `${KIBANA_DOCS}advanced-options.html#kibana-timelion-settings`,
502513
generalSettings: `${KIBANA_DOCS}advanced-options.html#kibana-general-settings`,
503-
savedObjectsApiList: `${KIBANA_DOCS}saved-objects-api.html#saved-objects-api`,
514+
savedObjectsApiList: isServerless
515+
? `${KIBANA_SERVERLESS_APIS}group/endpoint-saved-objects`
516+
: `${KIBANA_APIS}group/endpoint-saved-objects`,
504517
apiKeys: `${KIBANA_DOCS}api-keys.html`,
505518
},
506519
ml: {
@@ -693,41 +706,78 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
693706
skippingDisconnectedClusters: `${ELASTICSEARCH_DOCS}modules-cross-cluster-search.html#skip-unavailable-clusters`,
694707
},
695708
apis: {
696-
bulkIndexAlias: `${ELASTICSEARCH_DOCS}indices-aliases.html`,
697-
indexStats: `${ELASTICSEARCH_DOCS}indices-stats.html`,
698-
byteSizeUnits: `${ELASTICSEARCH_DOCS}api-conventions.html#byte-units`,
699-
createAutoFollowPattern: `${ELASTICSEARCH_DOCS}ccr-put-auto-follow-pattern.html`,
700-
createFollower: `${ELASTICSEARCH_DOCS}ccr-put-follow.html`,
701-
createIndex: `${ELASTICSEARCH_DOCS}indices-create-index.html`,
702-
createSnapshotLifecyclePolicy: `${ELASTICSEARCH_DOCS}slm-api-put-policy.html`,
703-
createRoleMapping: `${ELASTICSEARCH_DOCS}security-api-put-role-mapping.html`,
704-
createRoleMappingTemplates: `${ELASTICSEARCH_DOCS}security-api-put-role-mapping.html#_role_templates`,
705-
createRollupJobsRequest: `${ELASTICSEARCH_DOCS}rollup-put-job.html#rollup-put-job-api-request-body`,
706-
createApiKey: `${ELASTICSEARCH_DOCS}security-api-create-api-key.html`,
707-
createPipeline: `${ELASTICSEARCH_DOCS}put-pipeline-api.html`,
708-
createTransformRequest: `${ELASTICSEARCH_DOCS}put-transform.html#put-transform-request-body`,
709-
cronExpressions: `${ELASTICSEARCH_DOCS}cron-expressions.html`,
710-
executeWatchActionModes: `${ELASTICSEARCH_DOCS}watcher-api-execute-watch.html#watcher-api-execute-watch-action-mode`,
711-
indexExists: `${ELASTICSEARCH_DOCS}indices-exists.html`,
712-
inferTrainedModel: `${ELASTICSEARCH_DOCS}infer-trained-model.html`,
713-
multiSearch: `${ELASTICSEARCH_DOCS}search-multi-search.html`,
714-
openIndex: `${ELASTICSEARCH_DOCS}indices-open-close.html`,
715-
putComponentTemplate: `${ELASTICSEARCH_DOCS}indices-component-template.html`,
716-
painlessExecute: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/painless/${DOC_LINK_VERSION}/painless-execute-api.html`,
717-
painlessExecuteAPIContexts: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/painless/${DOC_LINK_VERSION}/painless-execute-api.html#_contexts`,
718-
putComponentTemplateMetadata: `${ELASTICSEARCH_DOCS}indices-component-template.html#component-templates-metadata`,
719-
putEnrichPolicy: `${ELASTICSEARCH_DOCS}put-enrich-policy-api.html`,
720-
putIndexTemplateV1: `${ELASTICSEARCH_DOCS}indices-templates-v1.html`,
721-
putSnapshotLifecyclePolicy: `${ELASTICSEARCH_DOCS}slm-api-put-policy.html`,
722-
putWatch: `${ELASTICSEARCH_DOCS}watcher-api-put-watch.html`,
723-
restApis: `${ELASTICSEARCH_DOCS}rest-apis.html`,
724-
searchPreference: `${ELASTICSEARCH_DOCS}search-search.html#search-preference`,
725-
securityApis: `${ELASTICSEARCH_DOCS}security-api.html`,
726-
simulatePipeline: `${ELASTICSEARCH_DOCS}simulate-pipeline-api.html`,
727-
tasks: `${ELASTICSEARCH_DOCS}tasks.html`,
728-
timeUnits: `${ELASTICSEARCH_DOCS}api-conventions.html#time-units`,
729-
unfreezeIndex: `${ELASTICSEARCH_DOCS}unfreeze-index-api.html`,
730-
updateTransform: `${ELASTICSEARCH_DOCS}update-transform.html`,
709+
bulkIndexAlias: isServerless
710+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-indices-update-aliases`
711+
: `${ELASTICSEARCH_APIS}operation/operation-indices-update-aliases`,
712+
indexStats: isServerless
713+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-indices-update-aliases`
714+
: `${ELASTICSEARCH_APIS}operation/operation-indices-stats`,
715+
byteSizeUnits: `${ELASTIC_DOCS}reference/elasticsearch/rest-apis/api-conventions#byte-units`,
716+
createAutoFollowPattern: `${ELASTICSEARCH_APIS}operation/operation-ccr-put-auto-follow-pattern`,
717+
createFollower: `${ELASTICSEARCH_APIS}operation/operation-ccr-follow`,
718+
createIndex: isServerless
719+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-indices-create`
720+
: `${ELASTICSEARCH_APIS}operation/operation-indices-create`,
721+
createSnapshotLifecyclePolicy: `${ELASTICSEARCH_APIS}operation/operation-slm-put-lifecycle`,
722+
createRoleMapping: `${ELASTICSEARCH_APIS}operation/operation-security-put-role-mapping`,
723+
createRoleMappingTemplates: `${ELASTICSEARCH_APIS}operation/operation-security-put-role-mapping`,
724+
createRollupJobsRequest: `${ELASTICSEARCH_APIS}operation/operation-rollup-put-job#operation-rollup-put-job-body-application-json`,
725+
createApiKey: isServerless
726+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-security-create-api-key`
727+
: `${ELASTICSEARCH_APIS}operation/operation-security-create-api-key`,
728+
createPipeline: isServerless
729+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-ingest-put-pipeline`
730+
: `${ELASTICSEARCH_APIS}operation/operation-ingest-put-pipeline`,
731+
createTransformRequest: isServerless
732+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-transform-put-transform`
733+
: `${ELASTICSEARCH_APIS}operation/operation-transform-put-transform`,
734+
cronExpressions: `${ELASTIC_DOCS}reference/elasticsearch/rest-apis/api-conventions#api-cron-expressions`,
735+
executeWatchActionModes: `${ELASTICSEARCH_APIS}operation/operation-watcher-execute-watch#operation-watcher-execute-watch-body-application-json`,
736+
indexExists: isServerless
737+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-indices-exists`
738+
: `${ELASTICSEARCH_APIS}operation/operation-indices-exists`,
739+
inferTrainedModel: isServerless
740+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-ml-infer-trained-model`
741+
: `${ELASTICSEARCH_APIS}operation/operation-ml-infer-trained-model`,
742+
multiSearch: isServerless
743+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-msearch`
744+
: `${ELASTICSEARCH_APIS}operation/operation-msearch`,
745+
openIndex: `${ELASTICSEARCH_APIS}operation/operation-indices-open`,
746+
putComponentTemplate: isServerless
747+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-cluster-put-component-template`
748+
: `${ELASTICSEARCH_APIS}operation/operation-cluster-put-component-template`,
749+
painlessExecute: isServerless
750+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-scripts-painless-execute`
751+
: `${ELASTICSEARCH_APIS}operation/operation-scripts-painless-execute`,
752+
painlessExecuteAPIContexts: isServerless
753+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-scripts-painless-execute#operation-scripts-painless-execute-body-application-json`
754+
: `${ELASTICSEARCH_APIS}operation/operation-scripts-painless-execute#operation-scripts-painless-execute-body-application-json`,
755+
putComponentTemplateMetadata: isServerless
756+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-cluster-put-component-template#operation-cluster-put-component-template-body-application-json-_meta`
757+
: `${ELASTICSEARCH_APIS}operation/operation-cluster-put-component-template#operation-cluster-put-component-template-body-application-json-_meta`,
758+
putEnrichPolicy: isServerless
759+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-enrich-put-policy`
760+
: `${ELASTICSEARCH_APIS}operation/operation-enrich-put-policy`,
761+
putIndexTemplateV1: `${ELASTICSEARCH_APIS}operation/operation-indices-put-template`,
762+
putSnapshotLifecyclePolicy: `${ELASTICSEARCH_APIS}operation/operation-slm-put-lifecycle`,
763+
putWatch: `${ELASTICSEARCH_APIS}operation/operation-watcher-put-watch`,
764+
restApis: isServerless ? `${ELASTICSEARCH_SERVERLESS_APIS}` : `${ELASTICSEARCH_APIS}`,
765+
searchPreference: isServerless
766+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-search#operation-search-preference`
767+
: `${ELASTICSEARCH_APIS}operation/operation-search#operation-search-preference`,
768+
securityApis: isServerless
769+
? `${ELASTICSEARCH_SERVERLESS_APIS}group/endpoint-security`
770+
: `${ELASTICSEARCH_APIS}group/endpoint-security`,
771+
simulatePipeline: isServerless
772+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-ingest-simulate`
773+
: `${ELASTICSEARCH_APIS}operation/operation-ingest-simulate`,
774+
tasks: isServerless
775+
? `${ELASTICSEARCH_SERVERLESS_APIS}group/endpoint-tasks`
776+
: `${ELASTICSEARCH_APIS}group/endpoint-tasks`,
777+
timeUnits: `${ELASTIC_DOCS}reference/elasticsearch/rest-apis/api-conventions#time-units`,
778+
updateTransform: isServerless
779+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-transform-update-transform`
780+
: `${ELASTICSEARCH_APIS}operation/operation-transform-update-transform`,
731781
},
732782
plugins: {
733783
azureRepo: `${ELASTICSEARCH_DOCS}repository-azure.html`,
@@ -742,14 +792,14 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
742792
guide: `${ELASTICSEARCH_DOCS}snapshot-restore.html`,
743793
changeIndexSettings: `${ELASTICSEARCH_DOCS}index-modules.html`,
744794
createSnapshot: `${ELASTICSEARCH_DOCS}snapshots-take-snapshot.html`,
745-
getSnapshot: `${ELASTICSEARCH_DOCS}get-snapshot-api.html`,
795+
getSnapshot: `${ELASTICSEARCH_APIS}operation/operation-snapshot-get`,
746796
registerSharedFileSystem: `${ELASTICSEARCH_DOCS}snapshots-filesystem-repository.html#filesystem-repository-settings`,
747797
registerSourceOnly: `${ELASTICSEARCH_DOCS}snapshots-source-only-repository.html#source-only-repository-settings`,
748798
registerUrl: `${ELASTICSEARCH_DOCS}snapshots-read-only-repository.html#read-only-url-repository-settings`,
749799
restoreSnapshot: `${ELASTICSEARCH_DOCS}snapshots-restore-snapshot.html`,
750-
restoreSnapshotApi: `${ELASTICSEARCH_DOCS}restore-snapshot-api.html#restore-snapshot-api-request-body`,
800+
restoreSnapshotApi: `${ELASTICSEARCH_APIS}operation/operation-snapshot-restore`,
751801
searchableSnapshotSharedCache: `${ELASTICSEARCH_DOCS}searchable-snapshots.html#searchable-snapshots-shared-cache`,
752-
slmStart: `${ELASTICSEARCH_DOCS}slm-api-start.html`,
802+
slmStart: `${ELASTICSEARCH_APIS}operation/operation-slm-start`,
753803
},
754804
ingest: {
755805
append: `${ELASTICSEARCH_DOCS}append-processor.html`,
@@ -962,7 +1012,9 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
9621012
hiddenFields: `${KIBANA_DOCS}playground-query.html#playground-hidden-fields`,
9631013
},
9641014
inferenceManagement: {
965-
inferenceAPIDocumentation: `${ELASTIC_WEBSITE_URL}docs/api/doc/elasticsearch/operation/operation-inference-put`,
1015+
inferenceAPIDocumentation: isServerless
1016+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-inference-put`
1017+
: `${ELASTICSEARCH_APIS}operation/operation-inference-put`,
9661018
},
9671019
synonyms: {
9681020
synonymsAPIDocumentation: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/current/synonyms-apis.html`,

src/platform/packages/shared/kbn-doc-links/src/get_doc_meta.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ export const getDocLinksMeta = ({
2525
elasticGithubUrl: 'https://github.com/elastic/',
2626
docsWebsiteUrl: 'https://www.elastic.co/docs/',
2727
searchLabsUrl: 'https://search-labs.elastic.co/',
28+
apiDocsUrl: 'https://www.elastic.co/docs/api/',
2829
};
2930
};

src/platform/packages/shared/kbn-doc-links/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export interface DocLinksMeta {
1717
elasticGithubUrl: string;
1818
docsWebsiteUrl: string;
1919
searchLabsUrl: string;
20+
apiDocsUrl: string;
2021
}
2122

2223
/**
@@ -381,7 +382,6 @@ export interface DocLinks {
381382
simulatePipeline: string;
382383
tasks: string;
383384
timeUnits: string;
384-
unfreezeIndex: string;
385385
updateTransform: string;
386386
}>;
387387
readonly observability: Readonly<{

src/platform/plugins/shared/saved_objects_management/public/management_section/object_view/components/__snapshots__/not_found_errors.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/platform/plugins/shared/index_management/__jest__/client_integration/index_details_page/index_details_page.test.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,12 @@ describe('<IndexDetailsPage />', () => {
222222
expect(tabContent).toEqual(JSON.stringify(testIndexStats, null, 2));
223223
});
224224

225-
it('sets the docs link href from the documenation service', async () => {
225+
it('sets the docs link href from the documentation service', async () => {
226226
await testBed.actions.clickIndexDetailsTab(IndexDetailsSection.Stats);
227227
const docsLinkHref = testBed.actions.stats.getDocsLinkHref();
228-
// the url from the mocked docs mock
229-
expect(docsLinkHref).toEqual(
230-
'https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/indices-stats.html'
231-
);
228+
229+
expect(docsLinkHref).toMatch(/^https:\/\/www\.elastic\.co\//);
230+
expect(docsLinkHref).toContain('indices-stats');
232231
});
233232

234233
it('renders a warning message if an index is not open', async () => {

0 commit comments

Comments
 (0)