Skip to content

Commit ce09ce5

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 41b029d commit ce09ce5

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`,
@@ -128,7 +133,9 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
128133
behavioralAnalyticsCORS: `${ELASTICSEARCH_DOCS}behavioral-analytics-cors.html`,
129134
behavioralAnalyticsEvents: `${ELASTICSEARCH_DOCS}behavioral-analytics-event.html`,
130135
buildConnector: `${ELASTICSEARCH_DOCS}es-build-connector.html`,
131-
bulkApi: `${ELASTICSEARCH_DOCS}docs-bulk.html`,
136+
bulkApi: isServerless
137+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-bulk`
138+
: `${ELASTICSEARCH_APIS}operation/operation-bulk`,
132139
configuration: `${ENTERPRISE_SEARCH_DOCS}configuration.html`,
133140
connectors: `${ELASTICSEARCH_DOCS}es-connectors.html`,
134141
connectorsClientDeploy: `${ELASTICSEARCH_DOCS}es-build-connector.html#es-connectors-deploy-connector-service`,
@@ -171,9 +178,13 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
171178
e5Model: `${MACHINE_LEARNING_DOCS}ml-nlp-e5.html`,
172179
elser: `${ELASTICSEARCH_DOCS}semantic-search-semantic-text.html`,
173180
engines: `${ENTERPRISE_SEARCH_DOCS}engines.html`,
174-
indexApi: `${ELASTICSEARCH_DOCS}docs-index_.html`,
175-
inferenceApiCreate: `${ELASTICSEARCH_DOCS}put-inference-api.html`,
176-
inferenceApisConfigureChunking: `${ELASTICSEARCH_DOCS}inference-apis.html#infer-chunking-config`,
181+
indexApi: isServerless
182+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-create`
183+
: `${ELASTICSEARCH_APIS}operation/operation-create`,
184+
inferenceApiCreate: isServerless
185+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-inference-put`
186+
: `${ELASTICSEARCH_APIS}operation/operation-inference-put`,
187+
inferenceApisConfigureChunking: `${ELASTIC_DOCS}explore-analyze/elastic-inference/inference-api#infer-chunking-config`,
177188
ingestionApis: `${ELASTICSEARCH_DOCS}search-with-elasticsearch.html`,
178189
ingestPipelines: `${ELASTICSEARCH_DOCS}ingest-pipeline-search.html`,
179190
knnSearch: `${ELASTICSEARCH_DOCS}knn-search.html`,
@@ -294,15 +305,15 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
294305
autocompleteSuggestions: `${KIBANA_DOCS}kibana-concepts-analysts.html#autocomplete-suggestions`,
295306
secureSavedObject: `${KIBANA_DOCS}xpack-security-secure-saved-objects.html`,
296307
xpackSecurity: `${KIBANA_DOCS}xpack-security.html`,
297-
restApis: `${KIBANA_DOCS}api.html`,
308+
restApis: isServerless ? `${KIBANA_SERVERLESS_APIS}` : `${KIBANA_APIS}`,
298309
dashboardImportExport: `${KIBANA_DOCS}dashboard-api.html`,
299310
upgradeNotes: `${KIBANA_DOCS}breaking-changes-summary.html`,
300311
},
301312
upgradeAssistant: {
302313
overview: `${KIBANA_DOCS}upgrade-assistant.html`,
303314
batchReindex: `${KIBANA_DOCS}batch-start-resume-reindex.html`,
304315
remoteReindex: `${ELASTICSEARCH_DOCS}docs-reindex.html#reindex-from-remote`,
305-
unfreezeApi: `${ELASTICSEARCH_DOCS}unfreeze-index-api.html`,
316+
unfreezeApi: `https://www.elastic.co/guide/en/elastic-stack/9.0/release-notes-elasticsearch-9.0.0.html#remove_unfreeze_rest_endpoint`,
306317
reindexWithPipeline: `${ELASTICSEARCH_DOCS}docs-reindex.html#reindex-with-an-ingest-pipeline`,
307318
},
308319
rollupJobs: `${KIBANA_DOCS}data-rollups.html`,
@@ -497,7 +508,9 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
497508
visualizationSettings: `${KIBANA_DOCS}advanced-options.html#kibana-visualization-settings`,
498509
timelionSettings: `${KIBANA_DOCS}advanced-options.html#kibana-timelion-settings`,
499510
generalSettings: `${KIBANA_DOCS}advanced-options.html#kibana-general-settings`,
500-
savedObjectsApiList: `${KIBANA_DOCS}saved-objects-api.html#saved-objects-api`,
511+
savedObjectsApiList: isServerless
512+
? `${KIBANA_SERVERLESS_APIS}group/endpoint-saved-objects`
513+
: `${KIBANA_APIS}group/endpoint-saved-objects`,
501514
apiKeys: `${KIBANA_DOCS}api-keys.html`,
502515
},
503516
ml: {
@@ -688,41 +701,78 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
688701
skippingDisconnectedClusters: `${ELASTICSEARCH_DOCS}modules-cross-cluster-search.html#skip-unavailable-clusters`,
689702
},
690703
apis: {
691-
bulkIndexAlias: `${ELASTICSEARCH_DOCS}indices-aliases.html`,
692-
indexStats: `${ELASTICSEARCH_DOCS}indices-stats.html`,
693-
byteSizeUnits: `${ELASTICSEARCH_DOCS}api-conventions.html#byte-units`,
694-
createAutoFollowPattern: `${ELASTICSEARCH_DOCS}ccr-put-auto-follow-pattern.html`,
695-
createFollower: `${ELASTICSEARCH_DOCS}ccr-put-follow.html`,
696-
createIndex: `${ELASTICSEARCH_DOCS}indices-create-index.html`,
697-
createSnapshotLifecyclePolicy: `${ELASTICSEARCH_DOCS}slm-api-put-policy.html`,
698-
createRoleMapping: `${ELASTICSEARCH_DOCS}security-api-put-role-mapping.html`,
699-
createRoleMappingTemplates: `${ELASTICSEARCH_DOCS}security-api-put-role-mapping.html#_role_templates`,
700-
createRollupJobsRequest: `${ELASTICSEARCH_DOCS}rollup-put-job.html#rollup-put-job-api-request-body`,
701-
createApiKey: `${ELASTICSEARCH_DOCS}security-api-create-api-key.html`,
702-
createPipeline: `${ELASTICSEARCH_DOCS}put-pipeline-api.html`,
703-
createTransformRequest: `${ELASTICSEARCH_DOCS}put-transform.html#put-transform-request-body`,
704-
cronExpressions: `${ELASTICSEARCH_DOCS}cron-expressions.html`,
705-
executeWatchActionModes: `${ELASTICSEARCH_DOCS}watcher-api-execute-watch.html#watcher-api-execute-watch-action-mode`,
706-
indexExists: `${ELASTICSEARCH_DOCS}indices-exists.html`,
707-
inferTrainedModel: `${ELASTICSEARCH_DOCS}infer-trained-model.html`,
708-
multiSearch: `${ELASTICSEARCH_DOCS}search-multi-search.html`,
709-
openIndex: `${ELASTICSEARCH_DOCS}indices-open-close.html`,
710-
putComponentTemplate: `${ELASTICSEARCH_DOCS}indices-component-template.html`,
711-
painlessExecute: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/painless/${DOC_LINK_VERSION}/painless-execute-api.html`,
712-
painlessExecuteAPIContexts: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/painless/${DOC_LINK_VERSION}/painless-execute-api.html#_contexts`,
713-
putComponentTemplateMetadata: `${ELASTICSEARCH_DOCS}indices-component-template.html#component-templates-metadata`,
714-
putEnrichPolicy: `${ELASTICSEARCH_DOCS}put-enrich-policy-api.html`,
715-
putIndexTemplateV1: `${ELASTICSEARCH_DOCS}indices-templates-v1.html`,
716-
putSnapshotLifecyclePolicy: `${ELASTICSEARCH_DOCS}slm-api-put-policy.html`,
717-
putWatch: `${ELASTICSEARCH_DOCS}watcher-api-put-watch.html`,
718-
restApis: `${ELASTICSEARCH_DOCS}rest-apis.html`,
719-
searchPreference: `${ELASTICSEARCH_DOCS}search-search.html#search-preference`,
720-
securityApis: `${ELASTICSEARCH_DOCS}security-api.html`,
721-
simulatePipeline: `${ELASTICSEARCH_DOCS}simulate-pipeline-api.html`,
722-
tasks: `${ELASTICSEARCH_DOCS}tasks.html`,
723-
timeUnits: `${ELASTICSEARCH_DOCS}api-conventions.html#time-units`,
724-
unfreezeIndex: `${ELASTICSEARCH_DOCS}unfreeze-index-api.html`,
725-
updateTransform: `${ELASTICSEARCH_DOCS}update-transform.html`,
704+
bulkIndexAlias: isServerless
705+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-indices-update-aliases`
706+
: `${ELASTICSEARCH_APIS}operation/operation-indices-update-aliases`,
707+
indexStats: isServerless
708+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-indices-update-aliases`
709+
: `${ELASTICSEARCH_APIS}operation/operation-indices-stats`,
710+
byteSizeUnits: `${ELASTIC_DOCS}reference/elasticsearch/rest-apis/api-conventions#byte-units`,
711+
createAutoFollowPattern: `${ELASTICSEARCH_APIS}operation/operation-ccr-put-auto-follow-pattern`,
712+
createFollower: `${ELASTICSEARCH_APIS}operation/operation-ccr-follow`,
713+
createIndex: isServerless
714+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-indices-create`
715+
: `${ELASTICSEARCH_APIS}operation/operation-indices-create`,
716+
createSnapshotLifecyclePolicy: `${ELASTICSEARCH_APIS}operation/operation-slm-put-lifecycle`,
717+
createRoleMapping: `${ELASTICSEARCH_APIS}operation/operation-security-put-role-mapping`,
718+
createRoleMappingTemplates: `${ELASTICSEARCH_APIS}operation/operation-security-put-role-mapping`,
719+
createRollupJobsRequest: `${ELASTICSEARCH_APIS}operation/operation-rollup-put-job#operation-rollup-put-job-body-application-json`,
720+
createApiKey: isServerless
721+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-security-create-api-key`
722+
: `${ELASTICSEARCH_APIS}operation/operation-security-create-api-key`,
723+
createPipeline: isServerless
724+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-ingest-put-pipeline`
725+
: `${ELASTICSEARCH_APIS}operation/operation-ingest-put-pipeline`,
726+
createTransformRequest: isServerless
727+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-transform-put-transform`
728+
: `${ELASTICSEARCH_APIS}operation/operation-transform-put-transform`,
729+
cronExpressions: `${ELASTIC_DOCS}reference/elasticsearch/rest-apis/api-conventions#api-cron-expressions`,
730+
executeWatchActionModes: `${ELASTICSEARCH_APIS}operation/operation-watcher-execute-watch#operation-watcher-execute-watch-body-application-json`,
731+
indexExists: isServerless
732+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-indices-exists`
733+
: `${ELASTICSEARCH_APIS}operation/operation-indices-exists`,
734+
inferTrainedModel: isServerless
735+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-ml-infer-trained-model`
736+
: `${ELASTICSEARCH_APIS}operation/operation-ml-infer-trained-model`,
737+
multiSearch: isServerless
738+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-msearch`
739+
: `${ELASTICSEARCH_APIS}operation/operation-msearch`,
740+
openIndex: `${ELASTICSEARCH_APIS}operation/operation-indices-open`,
741+
putComponentTemplate: isServerless
742+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-cluster-put-component-template`
743+
: `${ELASTICSEARCH_APIS}operation/operation-cluster-put-component-template`,
744+
painlessExecute: isServerless
745+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-scripts-painless-execute`
746+
: `${ELASTICSEARCH_APIS}operation/operation-scripts-painless-execute`,
747+
painlessExecuteAPIContexts: isServerless
748+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-scripts-painless-execute#operation-scripts-painless-execute-body-application-json`
749+
: `${ELASTICSEARCH_APIS}operation/operation-scripts-painless-execute#operation-scripts-painless-execute-body-application-json`,
750+
putComponentTemplateMetadata: isServerless
751+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-cluster-put-component-template#operation-cluster-put-component-template-body-application-json-_meta`
752+
: `${ELASTICSEARCH_APIS}operation/operation-cluster-put-component-template#operation-cluster-put-component-template-body-application-json-_meta`,
753+
putEnrichPolicy: isServerless
754+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-enrich-put-policy`
755+
: `${ELASTICSEARCH_APIS}operation/operation-enrich-put-policy`,
756+
putIndexTemplateV1: `${ELASTICSEARCH_APIS}operation/operation-indices-put-template`,
757+
putSnapshotLifecyclePolicy: `${ELASTICSEARCH_APIS}operation/operation-slm-put-lifecycle`,
758+
putWatch: `${ELASTICSEARCH_APIS}operation/operation-watcher-put-watch`,
759+
restApis: isServerless ? `${ELASTICSEARCH_SERVERLESS_APIS}` : `${ELASTICSEARCH_APIS}`,
760+
searchPreference: isServerless
761+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-search#operation-search-preference`
762+
: `${ELASTICSEARCH_APIS}operation/operation-search#operation-search-preference`,
763+
securityApis: isServerless
764+
? `${ELASTICSEARCH_SERVERLESS_APIS}group/endpoint-security`
765+
: `${ELASTICSEARCH_APIS}group/endpoint-security`,
766+
simulatePipeline: isServerless
767+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-ingest-simulate`
768+
: `${ELASTICSEARCH_APIS}operation/operation-ingest-simulate`,
769+
tasks: isServerless
770+
? `${ELASTICSEARCH_SERVERLESS_APIS}group/endpoint-tasks`
771+
: `${ELASTICSEARCH_APIS}group/endpoint-tasks`,
772+
timeUnits: `${ELASTIC_DOCS}reference/elasticsearch/rest-apis/api-conventions#time-units`,
773+
updateTransform: isServerless
774+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-transform-update-transform`
775+
: `${ELASTICSEARCH_APIS}operation/operation-transform-update-transform`,
726776
},
727777
plugins: {
728778
azureRepo: `${ELASTICSEARCH_DOCS}repository-azure.html`,
@@ -737,14 +787,14 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
737787
guide: `${ELASTICSEARCH_DOCS}snapshot-restore.html`,
738788
changeIndexSettings: `${ELASTICSEARCH_DOCS}index-modules.html`,
739789
createSnapshot: `${ELASTICSEARCH_DOCS}snapshots-take-snapshot.html`,
740-
getSnapshot: `${ELASTICSEARCH_DOCS}get-snapshot-api.html`,
790+
getSnapshot: `${ELASTICSEARCH_APIS}operation/operation-snapshot-get`,
741791
registerSharedFileSystem: `${ELASTICSEARCH_DOCS}snapshots-filesystem-repository.html#filesystem-repository-settings`,
742792
registerSourceOnly: `${ELASTICSEARCH_DOCS}snapshots-source-only-repository.html#source-only-repository-settings`,
743793
registerUrl: `${ELASTICSEARCH_DOCS}snapshots-read-only-repository.html#read-only-url-repository-settings`,
744794
restoreSnapshot: `${ELASTICSEARCH_DOCS}snapshots-restore-snapshot.html`,
745-
restoreSnapshotApi: `${ELASTICSEARCH_DOCS}restore-snapshot-api.html#restore-snapshot-api-request-body`,
795+
restoreSnapshotApi: `${ELASTICSEARCH_APIS}operation/operation-snapshot-restore`,
746796
searchableSnapshotSharedCache: `${ELASTICSEARCH_DOCS}searchable-snapshots.html#searchable-snapshots-shared-cache`,
747-
slmStart: `${ELASTICSEARCH_DOCS}slm-api-start.html`,
797+
slmStart: `${ELASTICSEARCH_APIS}operation/operation-slm-start`,
748798
},
749799
ingest: {
750800
append: `${ELASTICSEARCH_DOCS}append-processor.html`,
@@ -956,7 +1006,9 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
9561006
hiddenFields: `${KIBANA_DOCS}playground-query.html#playground-hidden-fields`,
9571007
},
9581008
inferenceManagement: {
959-
inferenceAPIDocumentation: `${ELASTIC_WEBSITE_URL}docs/api/doc/elasticsearch/operation/operation-inference-put`,
1009+
inferenceAPIDocumentation: isServerless
1010+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-inference-put`
1011+
: `${ELASTICSEARCH_APIS}operation/operation-inference-put`,
9601012
},
9611013
synonyms: {
9621014
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
/**
@@ -378,7 +379,6 @@ export interface DocLinks {
378379
simulatePipeline: string;
379380
tasks: string;
380381
timeUnits: string;
381-
unfreezeIndex: string;
382382
updateTransform: string;
383383
}>;
384384
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)