Skip to content

Commit c0768ea

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 906ff07 commit c0768ea

File tree

5 files changed

+106
-53
lines changed

5 files changed

+106
-53
lines changed

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

Lines changed: 96 additions & 43 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}/`;
@@ -49,7 +55,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
4955
elasticStackGetStarted: isServerless
5056
? `${SERVERLESS_DOCS}intro.html`
5157
: `${ELASTIC_WEBSITE_URL}guide/en/index.html`,
52-
apiReference: `${ELASTIC_WEBSITE_URL}guide/en/starting-with-the-elasticsearch-platform-and-its-solutions/current/api-reference.html`,
58+
apiReference: `${API_DOCS}`,
5359
upgrade: {
5460
upgradingStackOnPrem: `${ELASTIC_WEBSITE_URL}guide/en/elastic-stack/current/upgrading-elastic-stack-on-prem.html`,
5561
upgradingStackOnCloud: `${ELASTIC_WEBSITE_URL}guide/en/elastic-stack/current/upgrade-elastic-stack-for-elastic-cloud.html`,
@@ -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
inferenceApisConfigureChunking: `${ELASTICSEARCH_DOCS}inference-apis.html#infer-chunking-config`,
208220
ingestionApis: `${ELASTICSEARCH_DOCS}search-with-elasticsearch.html`,
209221
ingestPipelines: `${ELASTICSEARCH_DOCS}ingest-pipeline-search.html`,
@@ -363,7 +375,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
363375
autocompleteSuggestions: `${KIBANA_DOCS}kibana-concepts-analysts.html#autocomplete-suggestions`,
364376
secureSavedObject: `${KIBANA_DOCS}xpack-security-secure-saved-objects.html`,
365377
xpackSecurity: `${KIBANA_DOCS}xpack-security.html`,
366-
restApis: `${KIBANA_DOCS}api.html`,
378+
restApis: isServerless ? `${KIBANA_SERVERLESS_APIS}` : `${KIBANA_APIS}`,
367379
dashboardImportExport: `${KIBANA_DOCS}dashboard-api.html`,
368380
legacyOpenSslProvider: `${KIBANA_DOCS}production.html#openssl-legacy-provider`,
369381
},
@@ -564,7 +576,9 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
564576
visualizationSettings: `${KIBANA_DOCS}advanced-options.html#kibana-visualization-settings`,
565577
timelionSettings: `${KIBANA_DOCS}advanced-options.html#kibana-timelion-settings`,
566578
generalSettings: `${KIBANA_DOCS}advanced-options.html#kibana-general-settings`,
567-
savedObjectsApiList: `${KIBANA_DOCS}saved-objects-api.html#saved-objects-api`,
579+
savedObjectsApiList: isServerless
580+
? `${KIBANA_SERVERLESS_APIS}group/endpoint-saved-objects`
581+
: `${KIBANA_APIS}group/endpoint-saved-objects`,
568582
apiKeys: `${KIBANA_DOCS}api-keys.html`,
569583
},
570584
ml: {
@@ -773,41 +787,78 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
773787
skippingDisconnectedClusters: `${ELASTICSEARCH_DOCS}modules-cross-cluster-search.html#skip-unavailable-clusters`,
774788
},
775789
apis: {
776-
bulkIndexAlias: `${ELASTICSEARCH_DOCS}indices-aliases.html`,
777-
indexStats: `${ELASTICSEARCH_DOCS}indices-stats.html`,
790+
bulkIndexAlias: isServerless
791+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-indices-update-aliases`
792+
: `${ELASTICSEARCH_APIS}operation/operation-indices-update-aliases`,
793+
indexStats: isServerless
794+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-indices-update-aliases`
795+
: `${ELASTICSEARCH_APIS}operation/operation-indices-stats`,
778796
byteSizeUnits: `${ELASTICSEARCH_DOCS}api-conventions.html#byte-units`,
779-
createAutoFollowPattern: `${ELASTICSEARCH_DOCS}ccr-put-auto-follow-pattern.html`,
780-
createFollower: `${ELASTICSEARCH_DOCS}ccr-put-follow.html`,
781-
createIndex: `${ELASTICSEARCH_DOCS}indices-create-index.html`,
782-
createSnapshotLifecyclePolicy: `${ELASTICSEARCH_DOCS}slm-api-put-policy.html`,
783-
createRoleMapping: `${ELASTICSEARCH_DOCS}security-api-put-role-mapping.html`,
784-
createRoleMappingTemplates: `${ELASTICSEARCH_DOCS}security-api-put-role-mapping.html#_role_templates`,
785-
createRollupJobsRequest: `${ELASTICSEARCH_DOCS}rollup-put-job.html#rollup-put-job-api-request-body`,
786-
createApiKey: `${ELASTICSEARCH_DOCS}security-api-create-api-key.html`,
787-
createPipeline: `${ELASTICSEARCH_DOCS}put-pipeline-api.html`,
788-
createTransformRequest: `${ELASTICSEARCH_DOCS}put-transform.html#put-transform-request-body`,
797+
createAutoFollowPattern: `${ELASTICSEARCH_APIS}operation/operation-ccr-put-auto-follow-pattern`,
798+
createFollower: `${ELASTICSEARCH_APIS}operation/operation-ccr-follow`,
799+
createIndex: isServerless
800+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-indices-create`
801+
: `${ELASTICSEARCH_APIS}operation/operation-indices-create`,
802+
createSnapshotLifecyclePolicy: `${ELASTICSEARCH_APIS}operation/operation-slm-put-lifecycle`,
803+
createRoleMapping: `${ELASTICSEARCH_APIS}operation/operation-security-put-role-mapping`,
804+
createRoleMappingTemplates: `${ELASTICSEARCH_APIS}operation/operation-security-put-role-mapping`,
805+
createRollupJobsRequest: `${ELASTICSEARCH_APIS}operation/operation-rollup-put-job#operation-rollup-put-job-body-application-json`,
806+
createApiKey: isServerless
807+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-security-create-api-key`
808+
: `${ELASTICSEARCH_APIS}operation/operation-security-create-api-key`,
809+
createPipeline: isServerless
810+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-ingest-put-pipeline`
811+
: `${ELASTICSEARCH_APIS}operation/operation-ingest-put-pipeline`,
812+
createTransformRequest: isServerless
813+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-transform-put-transform`
814+
: `${ELASTICSEARCH_APIS}operation/operation-transform-put-transform`,
789815
cronExpressions: `${ELASTICSEARCH_DOCS}cron-expressions.html`,
790-
executeWatchActionModes: `${ELASTICSEARCH_DOCS}watcher-api-execute-watch.html#watcher-api-execute-watch-action-mode`,
791-
indexExists: `${ELASTICSEARCH_DOCS}indices-exists.html`,
792-
inferTrainedModel: `${ELASTICSEARCH_DOCS}infer-trained-model.html`,
793-
multiSearch: `${ELASTICSEARCH_DOCS}search-multi-search.html`,
794-
openIndex: `${ELASTICSEARCH_DOCS}indices-open-close.html`,
795-
putComponentTemplate: `${ELASTICSEARCH_DOCS}indices-component-template.html`,
796-
painlessExecute: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/painless/${DOC_LINK_VERSION}/painless-execute-api.html`,
797-
painlessExecuteAPIContexts: `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/painless/${DOC_LINK_VERSION}/painless-execute-api.html#_contexts`,
798-
putComponentTemplateMetadata: `${ELASTICSEARCH_DOCS}indices-component-template.html#component-templates-metadata`,
799-
putEnrichPolicy: `${ELASTICSEARCH_DOCS}put-enrich-policy-api.html`,
800-
putIndexTemplateV1: `${ELASTICSEARCH_DOCS}indices-templates-v1.html`,
801-
putSnapshotLifecyclePolicy: `${ELASTICSEARCH_DOCS}slm-api-put-policy.html`,
802-
putWatch: `${ELASTICSEARCH_DOCS}watcher-api-put-watch.html`,
803-
restApis: `${ELASTICSEARCH_DOCS}rest-apis.html`,
804-
searchPreference: `${ELASTICSEARCH_DOCS}search-search.html#search-preference`,
805-
securityApis: `${ELASTICSEARCH_DOCS}security-api.html`,
806-
simulatePipeline: `${ELASTICSEARCH_DOCS}simulate-pipeline-api.html`,
807-
tasks: `${ELASTICSEARCH_DOCS}tasks.html`,
808-
timeUnits: `${ELASTICSEARCH_DOCS}api-conventions.html#time-units`,
809-
unfreezeIndex: `${ELASTICSEARCH_DOCS}unfreeze-index-api.html`,
810-
updateTransform: `${ELASTICSEARCH_DOCS}update-transform.html`,
816+
executeWatchActionModes: `${ELASTICSEARCH_APIS}operation/operation-watcher-execute-watch#operation-watcher-execute-watch-body-application-json`,
817+
indexExists: isServerless
818+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-indices-exists`
819+
: `${ELASTICSEARCH_APIS}operation/operation-indices-exists`,
820+
inferTrainedModel: isServerless
821+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-ml-infer-trained-model`
822+
: `${ELASTICSEARCH_APIS}operation/operation-ml-infer-trained-model`,
823+
multiSearch: isServerless
824+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-msearch`
825+
: `${ELASTICSEARCH_APIS}operation/operation-msearch`,
826+
openIndex: `${ELASTICSEARCH_APIS}operation/operation-indices-open`,
827+
putComponentTemplate: isServerless
828+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-cluster-put-component-template`
829+
: `${ELASTICSEARCH_APIS}operation/operation-cluster-put-component-template`,
830+
painlessExecute: isServerless
831+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-scripts-painless-execute`
832+
: `${ELASTICSEARCH_APIS}operation/operation-scripts-painless-execute`,
833+
painlessExecuteAPIContexts: isServerless
834+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-scripts-painless-execute#operation-scripts-painless-execute-body-application-json`
835+
: `${ELASTICSEARCH_APIS}operation/operation-scripts-painless-execute#operation-scripts-painless-execute-body-application-json`,
836+
putComponentTemplateMetadata: isServerless
837+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-cluster-put-component-template#operation-cluster-put-component-template-body-application-json-_meta`
838+
: `${ELASTICSEARCH_APIS}operation/operation-cluster-put-component-template#operation-cluster-put-component-template-body-application-json-_meta`,
839+
putEnrichPolicy: isServerless
840+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-enrich-put-policy`
841+
: `${ELASTICSEARCH_APIS}operation/operation-enrich-put-policy`,
842+
putIndexTemplateV1: `${ELASTICSEARCH_APIS}operation/operation-indices-put-template`,
843+
putSnapshotLifecyclePolicy: `${ELASTICSEARCH_APIS}operation/operation-slm-put-lifecycle`,
844+
putWatch: `${ELASTICSEARCH_APIS}operation/operation-watcher-put-watch`,
845+
restApis: isServerless ? `${ELASTICSEARCH_SERVERLESS_APIS}` : `${ELASTICSEARCH_APIS}`,
846+
searchPreference: isServerless
847+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-search#operation-search-preference`
848+
: `${ELASTICSEARCH_APIS}operation/operation-search#operation-search-preference`,
849+
securityApis: isServerless
850+
? `${ELASTICSEARCH_SERVERLESS_APIS}group/endpoint-security`
851+
: `${ELASTICSEARCH_APIS}group/endpoint-security`,
852+
simulatePipeline: isServerless
853+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-ingest-simulate`
854+
: `${ELASTICSEARCH_APIS}operation/operation-ingest-simulate`,
855+
tasks: isServerless
856+
? `${ELASTICSEARCH_SERVERLESS_APIS}group/endpoint-tasks`
857+
: `${ELASTICSEARCH_APIS}group/endpoint-tasks`,
858+
timeUnits: `${ELASTIC_DOCS}reference/elasticsearch/rest-apis/api-conventions#time-units`,
859+
updateTransform: isServerless
860+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-transform-update-transform`
861+
: `${ELASTICSEARCH_APIS}operation/operation-transform-update-transform`,
811862
},
812863
plugins: {
813864
azureRepo: `${ELASTICSEARCH_DOCS}repository-azure.html`,
@@ -822,14 +873,14 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
822873
guide: `${ELASTICSEARCH_DOCS}snapshot-restore.html`,
823874
changeIndexSettings: `${ELASTICSEARCH_DOCS}index-modules.html`,
824875
createSnapshot: `${ELASTICSEARCH_DOCS}snapshots-take-snapshot.html`,
825-
getSnapshot: `${ELASTICSEARCH_DOCS}get-snapshot-api.html`,
876+
getSnapshot: `${ELASTICSEARCH_APIS}operation/operation-snapshot-get`,
826877
registerSharedFileSystem: `${ELASTICSEARCH_DOCS}snapshots-filesystem-repository.html#filesystem-repository-settings`,
827878
registerSourceOnly: `${ELASTICSEARCH_DOCS}snapshots-source-only-repository.html#source-only-repository-settings`,
828879
registerUrl: `${ELASTICSEARCH_DOCS}snapshots-read-only-repository.html#read-only-url-repository-settings`,
829880
restoreSnapshot: `${ELASTICSEARCH_DOCS}snapshots-restore-snapshot.html`,
830-
restoreSnapshotApi: `${ELASTICSEARCH_DOCS}restore-snapshot-api.html#restore-snapshot-api-request-body`,
881+
restoreSnapshotApi: `${ELASTICSEARCH_APIS}operation/operation-snapshot-restore`,
831882
searchableSnapshotSharedCache: `${ELASTICSEARCH_DOCS}searchable-snapshots.html#searchable-snapshots-shared-cache`,
832-
slmStart: `${ELASTICSEARCH_DOCS}slm-api-start.html`,
883+
slmStart: `${ELASTICSEARCH_APIS}operation/operation-slm-start`,
833884
},
834885
ingest: {
835886
append: `${ELASTICSEARCH_DOCS}append-processor.html`,
@@ -1041,7 +1092,9 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
10411092
hiddenFields: `${KIBANA_DOCS}playground-query.html#playground-hidden-fields`,
10421093
},
10431094
inferenceManagement: {
1044-
inferenceAPIDocumentation: `${ELASTIC_WEBSITE_URL}docs/api/doc/elasticsearch/operation/operation-inference-put`,
1095+
inferenceAPIDocumentation: isServerless
1096+
? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-inference-put`
1097+
: `${ELASTICSEARCH_APIS}operation/operation-inference-put`,
10451098
},
10461099
cases: {
10471100
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
/**
@@ -443,7 +444,6 @@ export interface DocLinks {
443444
simulatePipeline: string;
444445
tasks: string;
445446
timeUnits: string;
446-
unfreezeIndex: string;
447447
updateTransform: string;
448448
}>;
449449
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)