Skip to content

Commit bcebdfa

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

File tree

5 files changed

+108
-55
lines changed

5 files changed

+108
-55
lines changed

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

Lines changed: 98 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,15 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
2525
const DOCS_WEBSITE_URL = meta.docsWebsiteUrl;
2626
const ELASTIC_GITHUB = meta.elasticGithubUrl;
2727
const SEARCH_LABS_URL = meta.searchLabsUrl;
28+
const API_DOCS = meta.apiDocsUrl;
29+
const ELASTIC_DOCS = meta.docsWebsiteUrl;
2830

2931
const ELASTICSEARCH_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}/`;
32+
const ELASTICSEARCH_APIS = `${API_DOCS}doc/elasticsearch/v8/`;
33+
const ELASTICSEARCH_SERVERLESS_APIS = `${API_DOCS}doc/elasticsearch-serverless/`;
3034
const KIBANA_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/`;
35+
const KIBANA_APIS = `${API_DOCS}doc/kibana/v8/`;
36+
const KIBANA_SERVERLESS_APIS = `{$API_DOCS}doc/serverless/`;
3137
const FLEET_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/fleet/${DOC_LINK_VERSION}/`;
3238
const INTEGRATIONS_DEV_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/integrations-developer/current/`;
3339
const PLUGIN_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/plugins/${DOC_LINK_VERSION}/`;
@@ -159,7 +165,9 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
159165
behavioralAnalyticsCORS: `${ELASTICSEARCH_DOCS}behavioral-analytics-cors.html`,
160166
behavioralAnalyticsEvents: `${ELASTICSEARCH_DOCS}behavioral-analytics-event.html`,
161167
buildConnector: `${ELASTICSEARCH_DOCS}es-build-connector.html`,
162-
bulkApi: `${ELASTICSEARCH_DOCS}docs-bulk.html`,
168+
bulkApi: isServerless
169+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-bulk`
170+
: `${ELASTICSEARCH_APIS}operation/operation-bulk`,
163171
configuration: `${ENTERPRISE_SEARCH_DOCS}configuration.html`,
164172
connectors: `${ELASTICSEARCH_DOCS}es-connectors.html`,
165173
connectorsClientDeploy: `${ELASTICSEARCH_DOCS}es-build-connector.html#es-connectors-deploy-connector-service`,
@@ -202,8 +210,12 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
202210
e5Model: `${MACHINE_LEARNING_DOCS}ml-nlp-e5.html`,
203211
elser: `${ELASTICSEARCH_DOCS}semantic-search-semantic-text.html`,
204212
engines: `${ENTERPRISE_SEARCH_DOCS}engines.html`,
205-
indexApi: `${ELASTICSEARCH_DOCS}docs-index_.html`,
206-
inferenceApiCreate: `${ELASTICSEARCH_DOCS}put-inference-api.html`,
213+
indexApi: isServerless
214+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-create`
215+
: `${ELASTICSEARCH_APIS}operation/operation-create`,
216+
inferenceApiCreate: isServerless
217+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-inference-put`
218+
: `${ELASTICSEARCH_APIS}operation/operation-inference-put`,
207219
ingestionApis: `${ELASTICSEARCH_DOCS}search-with-elasticsearch.html`,
208220
ingestPipelines: `${ELASTICSEARCH_DOCS}ingest-pipeline-search.html`,
209221
knnSearch: `${ELASTICSEARCH_DOCS}knn-search.html`,
@@ -362,7 +374,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
362374
autocompleteSuggestions: `${KIBANA_DOCS}kibana-concepts-analysts.html#autocomplete-suggestions`,
363375
secureSavedObject: `${KIBANA_DOCS}xpack-security-secure-saved-objects.html`,
364376
xpackSecurity: `${KIBANA_DOCS}xpack-security.html`,
365-
restApis: `${KIBANA_DOCS}api.html`,
377+
restApis: isServerless ? `${KIBANA_SERVERLESS_APIS}` : `${KIBANA_APIS}`,
366378
dashboardImportExport: `${KIBANA_DOCS}dashboard-api.html`,
367379
legacyOpenSslProvider: `${KIBANA_DOCS}production.html#openssl-legacy-provider`,
368380
},
@@ -371,7 +383,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
371383
batchReindex: `${KIBANA_DOCS}batch-start-resume-reindex.html`,
372384
indexBlocks: `${ELASTICSEARCH_DOCS}index-modules-blocks.html#index-block-settings`,
373385
remoteReindex: `${ELASTICSEARCH_DOCS}docs-reindex.html#reindex-from-remote`,
374-
unfreezeApi: `${ELASTICSEARCH_DOCS}unfreeze-index-api.html`,
386+
unfreezeApi: `${ELASTICSEARCH_DOCS}/unfreeze-index-api.html`,
375387
reindexWithPipeline: `${ELASTICSEARCH_DOCS}docs-reindex.html#reindex-with-an-ingest-pipeline`,
376388
logsDatastream: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}/logs-data-stream.html`,
377389
usingLogsDbIndexModeWithESSecurity: `${ELASTIC_WEBSITE_URL}guide/en/security/${DOC_LINK_VERSION}/detections-logsdb-index-mode-impact.html`,
@@ -566,7 +578,9 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
566578
visualizationSettings: `${KIBANA_DOCS}advanced-options.html#kibana-visualization-settings`,
567579
timelionSettings: `${KIBANA_DOCS}advanced-options.html#kibana-timelion-settings`,
568580
generalSettings: `${KIBANA_DOCS}advanced-options.html#kibana-general-settings`,
569-
savedObjectsApiList: `${KIBANA_DOCS}saved-objects-api.html#saved-objects-api`,
581+
savedObjectsApiList: isServerless
582+
? `${KIBANA_SERVERLESS_APIS}group/endpoint-saved-objects`
583+
: `${KIBANA_APIS}group/endpoint-saved-objects`,
570584
apiKeys: `${KIBANA_DOCS}api-keys.html`,
571585
},
572586
ml: {
@@ -775,41 +789,78 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
775789
skippingDisconnectedClusters: `${ELASTICSEARCH_DOCS}modules-cross-cluster-search.html#skip-unavailable-clusters`,
776790
},
777791
apis: {
778-
bulkIndexAlias: `${ELASTICSEARCH_DOCS}indices-aliases.html`,
779-
indexStats: `${ELASTICSEARCH_DOCS}indices-stats.html`,
780-
byteSizeUnits: `${ELASTICSEARCH_DOCS}api-conventions.html#byte-units`,
781-
createAutoFollowPattern: `${ELASTICSEARCH_DOCS}ccr-put-auto-follow-pattern.html`,
782-
createFollower: `${ELASTICSEARCH_DOCS}ccr-put-follow.html`,
783-
createIndex: `${ELASTICSEARCH_DOCS}indices-create-index.html`,
784-
createSnapshotLifecyclePolicy: `${ELASTICSEARCH_DOCS}slm-api-put-policy.html`,
785-
createRoleMapping: `${ELASTICSEARCH_DOCS}security-api-put-role-mapping.html`,
786-
createRoleMappingTemplates: `${ELASTICSEARCH_DOCS}security-api-put-role-mapping.html#_role_templates`,
787-
createRollupJobsRequest: `${ELASTICSEARCH_DOCS}rollup-put-job.html#rollup-put-job-api-request-body`,
788-
createApiKey: `${ELASTICSEARCH_DOCS}security-api-create-api-key.html`,
789-
createPipeline: `${ELASTICSEARCH_DOCS}put-pipeline-api.html`,
790-
createTransformRequest: `${ELASTICSEARCH_DOCS}put-transform.html#put-transform-request-body`,
791-
cronExpressions: `${ELASTICSEARCH_DOCS}cron-expressions.html`,
792-
executeWatchActionModes: `${ELASTICSEARCH_DOCS}watcher-api-execute-watch.html#watcher-api-execute-watch-action-mode`,
793-
indexExists: `${ELASTICSEARCH_DOCS}indices-exists.html`,
794-
inferTrainedModel: `${ELASTICSEARCH_DOCS}infer-trained-model.html`,
795-
multiSearch: `${ELASTICSEARCH_DOCS}search-multi-search.html`,
796-
openIndex: `${ELASTICSEARCH_DOCS}indices-open-close.html`,
797-
putComponentTemplate: `${ELASTICSEARCH_DOCS}indices-component-template.html`,
798-
painlessExecute: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/painless/${DOC_LINK_VERSION}/painless-execute-api.html`,
799-
painlessExecuteAPIContexts: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/painless/${DOC_LINK_VERSION}/painless-execute-api.html#_contexts`,
800-
putComponentTemplateMetadata: `${ELASTICSEARCH_DOCS}indices-component-template.html#component-templates-metadata`,
801-
putEnrichPolicy: `${ELASTICSEARCH_DOCS}put-enrich-policy-api.html`,
802-
putIndexTemplateV1: `${ELASTICSEARCH_DOCS}indices-templates-v1.html`,
803-
putSnapshotLifecyclePolicy: `${ELASTICSEARCH_DOCS}slm-api-put-policy.html`,
804-
putWatch: `${ELASTICSEARCH_DOCS}watcher-api-put-watch.html`,
805-
restApis: `${ELASTICSEARCH_DOCS}rest-apis.html`,
806-
searchPreference: `${ELASTICSEARCH_DOCS}search-search.html#search-preference`,
807-
securityApis: `${ELASTICSEARCH_DOCS}security-api.html`,
808-
simulatePipeline: `${ELASTICSEARCH_DOCS}simulate-pipeline-api.html`,
809-
tasks: `${ELASTICSEARCH_DOCS}tasks.html`,
810-
timeUnits: `${ELASTICSEARCH_DOCS}api-conventions.html#time-units`,
811-
unfreezeIndex: `${ELASTICSEARCH_DOCS}unfreeze-index-api.html`,
812-
updateTransform: `${ELASTICSEARCH_DOCS}update-transform.html`,
792+
bulkIndexAlias: isServerless
793+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-indices-update-aliases`
794+
: `${ELASTICSEARCH_APIS}operation/operation-indices-update-aliases`,
795+
indexStats: isServerless
796+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-indices-update-aliases`
797+
: `${ELASTICSEARCH_APIS}operation/operation-indices-stats`,
798+
byteSizeUnits: `${ELASTIC_DOCS}reference/elasticsearch/rest-apis/api-conventions#byte-units`,
799+
createAutoFollowPattern: `${ELASTICSEARCH_APIS}operation/operation-ccr-put-auto-follow-pattern`,
800+
createFollower: `${ELASTICSEARCH_APIS}operation/operation-ccr-follow`,
801+
createIndex: isServerless
802+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-indices-create`
803+
: `${ELASTICSEARCH_APIS}operation/operation-indices-create`,
804+
createSnapshotLifecyclePolicy: `${ELASTICSEARCH_APIS}operation/operation-slm-put-lifecycle`,
805+
createRoleMapping: `${ELASTICSEARCH_APIS}operation/operation-security-put-role-mapping`,
806+
createRoleMappingTemplates: `${ELASTICSEARCH_APIS}operation/operation-security-put-role-mapping`,
807+
createRollupJobsRequest: `${ELASTICSEARCH_APIS}operation/operation-rollup-put-job#operation-rollup-put-job-body-application-json`,
808+
createApiKey: isServerless
809+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-security-create-api-key`
810+
: `${ELASTICSEARCH_APIS}operation/operation-security-create-api-key`,
811+
createPipeline: isServerless
812+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-ingest-put-pipeline`
813+
: `${ELASTICSEARCH_APIS}operation/operation-ingest-put-pipeline`,
814+
createTransformRequest: isServerless
815+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-transform-put-transform`
816+
: `${ELASTICSEARCH_APIS}operation/operation-transform-put-transform`,
817+
cronExpressions: `${ELASTIC_DOCS}reference/elasticsearch/rest-apis/api-conventions#api-cron-expressions`,
818+
executeWatchActionModes: `${ELASTICSEARCH_APIS}operation/operation-watcher-execute-watch#operation-watcher-execute-watch-body-application-json`,
819+
indexExists: isServerless
820+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-indices-exists`
821+
: `${ELASTICSEARCH_APIS}operation/operation-indices-exists`,
822+
inferTrainedModel: isServerless
823+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-ml-infer-trained-model`
824+
: `${ELASTICSEARCH_APIS}operation/operation-ml-infer-trained-model`,
825+
multiSearch: isServerless
826+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-msearch`
827+
: `${ELASTICSEARCH_APIS}operation/operation-msearch`,
828+
openIndex: `${ELASTICSEARCH_APIS}operation/operation-indices-open`,
829+
putComponentTemplate: isServerless
830+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-cluster-put-component-template`
831+
: `${ELASTICSEARCH_APIS}operation/operation-cluster-put-component-template`,
832+
painlessExecute: isServerless
833+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-scripts-painless-execute`
834+
: `${ELASTICSEARCH_APIS}operation/operation-scripts-painless-execute`,
835+
painlessExecuteAPIContexts: isServerless
836+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-scripts-painless-execute#operation-scripts-painless-execute-body-application-json`
837+
: `${ELASTICSEARCH_APIS}operation/operation-scripts-painless-execute#operation-scripts-painless-execute-body-application-json`,
838+
putComponentTemplateMetadata: isServerless
839+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-cluster-put-component-template#operation-cluster-put-component-template-body-application-json-_meta`
840+
: `${ELASTICSEARCH_APIS}operation/operation-cluster-put-component-template#operation-cluster-put-component-template-body-application-json-_meta`,
841+
putEnrichPolicy: isServerless
842+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-enrich-put-policy`
843+
: `${ELASTICSEARCH_APIS}operation/operation-enrich-put-policy`,
844+
putIndexTemplateV1: `${ELASTICSEARCH_APIS}operation/operation-indices-put-template`,
845+
putSnapshotLifecyclePolicy: `${ELASTICSEARCH_APIS}operation/operation-slm-put-lifecycle`,
846+
putWatch: `${ELASTICSEARCH_APIS}operation/operation-watcher-put-watch`,
847+
restApis: isServerless ? `${ELASTICSEARCH_SERVERLESS_APIS}` : `${ELASTICSEARCH_APIS}`,
848+
searchPreference: isServerless
849+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-search#operation-search-preference`
850+
: `${ELASTICSEARCH_APIS}operation/operation-search#operation-search-preference`,
851+
securityApis: isServerless
852+
? `${ELASTICSEARCH_SERVERLESS_APIS}group/endpoint-security`
853+
: `${ELASTICSEARCH_APIS}group/endpoint-security`,
854+
simulatePipeline: isServerless
855+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-ingest-simulate`
856+
: `${ELASTICSEARCH_APIS}operation/operation-ingest-simulate`,
857+
tasks: isServerless
858+
? `${ELASTICSEARCH_SERVERLESS_APIS}group/endpoint-tasks`
859+
: `${ELASTICSEARCH_APIS}group/endpoint-tasks`,
860+
timeUnits: `${ELASTIC_DOCS}reference/elasticsearch/rest-apis/api-conventions#time-units`,
861+
updateTransform: isServerless
862+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-transform-update-transform`
863+
: `${ELASTICSEARCH_APIS}operation/operation-transform-update-transform`,
813864
},
814865
plugins: {
815866
azureRepo: `${ELASTICSEARCH_DOCS}repository-azure.html`,
@@ -824,14 +875,14 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
824875
guide: `${ELASTICSEARCH_DOCS}snapshot-restore.html`,
825876
changeIndexSettings: `${ELASTICSEARCH_DOCS}index-modules.html`,
826877
createSnapshot: `${ELASTICSEARCH_DOCS}snapshots-take-snapshot.html`,
827-
getSnapshot: `${ELASTICSEARCH_DOCS}get-snapshot-api.html`,
878+
getSnapshot: `${ELASTICSEARCH_APIS}operation/operation-snapshot-get`,
828879
registerSharedFileSystem: `${ELASTICSEARCH_DOCS}snapshots-filesystem-repository.html#filesystem-repository-settings`,
829880
registerSourceOnly: `${ELASTICSEARCH_DOCS}snapshots-source-only-repository.html#source-only-repository-settings`,
830881
registerUrl: `${ELASTICSEARCH_DOCS}snapshots-read-only-repository.html#read-only-url-repository-settings`,
831882
restoreSnapshot: `${ELASTICSEARCH_DOCS}snapshots-restore-snapshot.html`,
832-
restoreSnapshotApi: `${ELASTICSEARCH_DOCS}restore-snapshot-api.html#restore-snapshot-api-request-body`,
883+
restoreSnapshotApi: `${ELASTICSEARCH_APIS}operation/operation-snapshot-restore`,
833884
searchableSnapshotSharedCache: `${ELASTICSEARCH_DOCS}searchable-snapshots.html#searchable-snapshots-shared-cache`,
834-
slmStart: `${ELASTICSEARCH_DOCS}slm-api-start.html`,
885+
slmStart: `${ELASTICSEARCH_APIS}operation/operation-slm-start`,
835886
},
836887
ingest: {
837888
append: `${ELASTICSEARCH_DOCS}append-processor.html`,
@@ -1043,7 +1094,9 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
10431094
hiddenFields: `${KIBANA_DOCS}playground-query.html#playground-hidden-fields`,
10441095
},
10451096
inferenceManagement: {
1046-
inferenceAPIDocumentation: `${ELASTIC_WEBSITE_URL}docs/api/doc/elasticsearch/operation/operation-inference-put`,
1097+
inferenceAPIDocumentation: isServerless
1098+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-inference-put`
1099+
: `${ELASTICSEARCH_APIS}operation/operation-inference-put`,
10471100
},
10481101
cases: {
10491102
legacyApiDeprecations: `${KIBANA_DOCS}breaking-changes-summary.html#breaking-201004`,

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://docs.elastic.co/',
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
/**
@@ -445,7 +446,6 @@ export interface DocLinks {
445446
simulatePipeline: string;
446447
tasks: string;
447448
timeUnits: string;
448-
unfreezeIndex: string;
449449
updateTransform: string;
450450
}>;
451451
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)