From f0f0e15cc292164aa328252f54efc409cbdb0ac2 Mon Sep 17 00:00:00 2001 From: lcawl Date: Thu, 10 Apr 2025 19:07:28 -0700 Subject: [PATCH 1/4] [DOCS] Use new ML and transform URLs in doc link service --- .../shared/kbn-doc-links/src/get_doc_links.ts | 101 ++++++++++-------- .../shared/kbn-doc-links/src/get_doc_meta.ts | 1 + .../shared/kbn-doc-links/src/types.ts | 1 + 3 files changed, 59 insertions(+), 44 deletions(-) diff --git a/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts b/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts index 610ee56bb86df..739624b272d2e 100644 --- a/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts +++ b/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts @@ -24,9 +24,12 @@ 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 FLEET_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/fleet/${DOC_LINK_VERSION}/`; const INTEGRATIONS_DEV_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/integrations-developer/current/`; @@ -504,50 +507,56 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D apiKeys: `${KIBANA_DOCS}api-keys.html`, }, ml: { - guide: `${MACHINE_LEARNING_DOCS}index.html`, - aggregations: `${MACHINE_LEARNING_DOCS}ml-configuring-aggregation.html`, - anomalyDetection: `${MACHINE_LEARNING_DOCS}ml-ad-overview.html`, - anomalyDetectionBucketSpan: `${MACHINE_LEARNING_DOCS}ml-ad-run-jobs.html#ml-ad-bucket-span`, - anomalyDetectionConfiguringCategories: `${MACHINE_LEARNING_DOCS}ml-configuring-categories.html`, - anomalyDetectionCardinality: `${MACHINE_LEARNING_DOCS}ml-ad-run-jobs.html#ml-ad-cardinality`, - anomalyDetectionCreateJobs: `${MACHINE_LEARNING_DOCS}ml-ad-run-jobs.html#ml-ad-create-job`, - anomalyDetectionDetectors: `${MACHINE_LEARNING_DOCS}ml-ad-run-jobs.html#ml-ad-detectors`, - anomalyDetectionFunctions: `${MACHINE_LEARNING_DOCS}ml-functions.html`, - anomalyDetectionInfluencers: `${MACHINE_LEARNING_DOCS}ml-ad-run-jobs.html#ml-ad-influencers`, - anomalyDetectionJobs: `${MACHINE_LEARNING_DOCS}ml-ad-finding-anomalies.html`, - anomalyDetectionJobResource: `${ELASTICSEARCH_DOCS}ml-put-job.html#ml-put-job-path-parms`, - anomalyDetectionJobResourceAnalysisConfig: `${ELASTICSEARCH_DOCS}ml-put-job.html#put-analysisconfig`, - anomalyDetectionJobTips: `${MACHINE_LEARNING_DOCS}ml-ad-run-jobs.html#ml-ad-job-tips`, - anomalyDetectionScoreExplanation: `${MACHINE_LEARNING_DOCS}ml-ad-explain.html`, - alertingRules: `${MACHINE_LEARNING_DOCS}ml-configuring-alerts.html`, - anomalyDetectionModelMemoryLimits: `${MACHINE_LEARNING_DOCS}ml-ad-run-jobs.html#ml-ad-model-memory-limits`, - calendars: `${MACHINE_LEARNING_DOCS}ml-ad-run-jobs.html#ml-ad-calendars`, - classificationEvaluation: `${MACHINE_LEARNING_DOCS}ml-dfa-classification.html#ml-dfanalytics-classification-evaluation`, - customRules: `${MACHINE_LEARNING_DOCS}ml-ad-run-jobs.html#ml-ad-rules`, - customUrls: `${MACHINE_LEARNING_DOCS}ml-configuring-url.html`, - dataFrameAnalytics: `${MACHINE_LEARNING_DOCS}ml-dfanalytics.html`, - dFAPrepareData: `${MACHINE_LEARNING_DOCS}ml-dfa-overview.html#prepare-transform-data`, - dFAStartJob: `${ELASTICSEARCH_DOCS}start-dfanalytics.html`, - dFACreateJob: `${ELASTICSEARCH_DOCS}put-dfanalytics.html`, - featureImportance: `${MACHINE_LEARNING_DOCS}ml-feature-importance.html`, - outlierDetectionRoc: `${MACHINE_LEARNING_DOCS}ml-dfa-finding-outliers.html#ml-dfanalytics-roc`, - regressionEvaluation: `${MACHINE_LEARNING_DOCS}ml-dfa-regression.html#ml-dfanalytics-regression-evaluation`, - classificationAucRoc: `${MACHINE_LEARNING_DOCS}ml-dfa-classification.html#ml-dfanalytics-class-aucroc`, - setUpgradeMode: `${ELASTICSEARCH_DOCS}ml-set-upgrade-mode.html`, - trainedModels: `${MACHINE_LEARNING_DOCS}ml-trained-models.html`, - startTrainedModelsDeployment: `${MACHINE_LEARNING_DOCS}ml-nlp-deploy-model.html`, - logsAnomalyDetectionConfigs: `${MACHINE_LEARNING_DOCS}ootb-ml-jobs-logs-ui.html`, - metricsAnomalyDetectionConfigs: `${MACHINE_LEARNING_DOCS}ootb-ml-jobs-metrics-ui.html`, - nlpElser: `${MACHINE_LEARNING_DOCS}ml-nlp-elser.html`, - nlpE5: `${MACHINE_LEARNING_DOCS}ml-nlp-e5.html`, - nlpImportModel: `${MACHINE_LEARNING_DOCS}ml-nlp-import-model.html`, + guide: `${ELASTIC_DOCS}explore-analyze/machine-learning`, + aggregations: `${ELASTIC_DOCS}explore-analyze/machine-learning/anomaly-detection/ml-configuring-aggregation`, + anomalyDetection: `${ELASTIC_DOCS}explore-analyze/machine-learning/anomaly-detection`, + anomalyDetectionBucketSpan: `${ELASTIC_DOCS}explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-bucket-span`, + anomalyDetectionConfiguringCategories: `${ELASTIC_DOCS}explore-analyze/machine-learning/anomaly-detection/ml-configuring-categories`, + anomalyDetectionCardinality: `${ELASTIC_DOCS}explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-cardinality`, + anomalyDetectionCreateJobs: `${ELASTIC_DOCS}explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-create-job`, + anomalyDetectionDetectors: `${ELASTIC_DOCS}explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-detectors`, + anomalyDetectionFunctions: `${ELASTIC_DOCS}explore-analyze/machine-learning/anomaly-detection/ml-functions`, + anomalyDetectionInfluencers: `${ELASTIC_DOCS}explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-influencers`, + anomalyDetectionJobs: `${ELASTIC_DOCS}explore-analyze/machine-learning/anomaly-detection/ml-ad-finding-anomalies`, + anomalyDetectionJobResource: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-ml-put-job` + : `${ELASTICSEARCH_APIS}operation/operation-ml-put-job`, + anomalyDetectionJobResourceAnalysisConfig: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-ml-put-job` + : `${ELASTICSEARCH_APIS}operation/operation-ml-put-job`, + anomalyDetectionJobTips: `${ELASTIC_DOCS}explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs`, + anomalyDetectionScoreExplanation: `${ELASTIC_DOCS}explore-analyze/machine-learning/anomaly-detection/ml-ad-explain`, + alertingRules: `${ELASTIC_DOCS}explore-analyze/machine-learning/anomaly-detection/ml-configuring-alerts`, + anomalyDetectionModelMemoryLimits: `${ELASTIC_DOCS}explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-model-memory-limits`, + calendars: `${ELASTIC_DOCS}explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-calendars`, + classificationEvaluation: `${ELASTIC_DOCS}explore-analyze/machine-learning/data-frame-analytics/ml-dfa-classification#ml-dfanalytics-classification-evaluation`, + customRules: `${ELASTIC_DOCS}explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-rules`, + customUrls: `${ELASTIC_DOCS}explore-analyze/machine-learning/anomaly-detection/ml-configuring-url`, + dataFrameAnalytics: `${ELASTIC_DOCS}explore-analyze/machine-learning/data-frame-analytics`, + dFAPrepareData: `${ELASTIC_DOCS}explore-analyze/machine-learning/data-frame-analytics/ml-dfa-overview#prepare-transform-data`, + dFAStartJob: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-ml-start-data-frame-analytics` + : `${ELASTICSEARCH_APIS}operation/operation-ml-start-data-frame-analytics`, + dFACreateJob: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-ml-put-data-frame-analytics` + : `${ELASTICSEARCH_APIS}operation/operation-ml-put-data-frame-analytics`, + featureImportance: `${ELASTIC_DOCS}explore-analyze/machine-learning/data-frame-analytics/ml-feature-importance`, + outlierDetectionRoc: `${ELASTIC_DOCS}explore-analyze/machine-learning/data-frame-analytics/ml-dfa-finding-outliers#ml-dfanalytics-roc`, + regressionEvaluation: `${ELASTIC_DOCS}explore-analyze/machine-learning/data-frame-analytics/ml-dfa-regression#ml-dfanalytics-regression-evaluation`, + classificationAucRoc: `${ELASTIC_DOCS}explore-analyze/machine-learning/data-frame-analytics/ml-dfa-classification#ml-dfanalytics-class-aucroc`, + setUpgradeMode: `${ELASTICSEARCH_APIS}operation/operation-ml-set-upgrade-mode`, + trainedModels: `${ELASTIC_DOCS}explore-analyze/machine-learning/data-frame-analytics/ml-trained-models`, + startTrainedModelsDeployment: `${ELASTIC_DOCS}explore-analyze/machine-learning/nlp/ml-nlp-deploy-model`, + logsAnomalyDetectionConfigs: `${ELASTIC_DOCS}reference/data-analysis/machine-learning/ootb-ml-jobs-logs-ui`, + metricsAnomalyDetectionConfigs: `${ELASTIC_DOCS}reference/data-analysis/machine-learning/ootb-ml-jobs-metrics-ui`, + nlpElser: `${ELASTIC_DOCS}explore-analyze/machine-learning/nlp/ml-nlp-elser`, + nlpE5: `${ELASTIC_DOCS}explore-analyze/machine-learning/nlp/ml-nlp-e5`, + nlpImportModel: `${ELASTIC_DOCS}explore-analyze/machine-learning/nlp/ml-nlp-import-model`, }, transforms: { - guide: isServerless - ? `${SERVERLESS_DOCS}transforms.html` - : `${ELASTICSEARCH_DOCS}transforms.html`, - alertingRules: `${ELASTICSEARCH_DOCS}transform-alerts.html`, - overview: `${ELASTICSEARCH_DOCS}transform-overview.html`, + guide: `https://www.elastic.co/docs/explore-analyze/transforms`, + alertingRules: `https://www.elastic.co/docs/explore-analyze/transforms/transform-alerts`, + overview: `https://www.elastic.co/docs/explore-analyze/transforms/transform-overview`, }, visualize: { guide: `${KIBANA_DOCS}_panels_and_visualizations.html`, @@ -962,13 +971,17 @@ 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`, }, queryRules: { - queryRulesAPIDocumentation: `${ELASTIC_WEBSITE_URL}docs/api/doc/elasticsearch/group/endpoint-query_rules`, + queryRulesAPIDocumentation: isServerless + ? `${ELASTICSEARCH_SERVERLESS_APIS}group/endpoint-query_rules` + : `${ELASTICSEARCH_APIS}group/endpoint-query_rules`, }, }); }; diff --git a/src/platform/packages/shared/kbn-doc-links/src/get_doc_meta.ts b/src/platform/packages/shared/kbn-doc-links/src/get_doc_meta.ts index 887fe2820c457..80da5190e0cfc 100644 --- a/src/platform/packages/shared/kbn-doc-links/src/get_doc_meta.ts +++ b/src/platform/packages/shared/kbn-doc-links/src/get_doc_meta.ts @@ -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/', }; }; diff --git a/src/platform/packages/shared/kbn-doc-links/src/types.ts b/src/platform/packages/shared/kbn-doc-links/src/types.ts index 8ba8d92f3d3c1..e733852018564 100644 --- a/src/platform/packages/shared/kbn-doc-links/src/types.ts +++ b/src/platform/packages/shared/kbn-doc-links/src/types.ts @@ -17,6 +17,7 @@ export interface DocLinksMeta { elasticGithubUrl: string; docsWebsiteUrl: string; searchLabsUrl: string; + apiDocsUrl: string; } /** From b477d455f59b47e614e19833ea0f95382f979ff0 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 11 Apr 2025 02:36:43 +0000 Subject: [PATCH 2/4] [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' --- .../packages/shared/kbn-doc-links/src/get_doc_links.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts b/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts index 739624b272d2e..6858d093f0d59 100644 --- a/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts +++ b/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts @@ -972,16 +972,16 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D }, inferenceManagement: { inferenceAPIDocumentation: isServerless - ? `${ELASTICSEARCH_SERVERLESS_APIS}operation/operation-inference-put` - : `${ELASTICSEARCH_APIS}operation/operation-inference-put`, + ? `${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`, }, queryRules: { queryRulesAPIDocumentation: isServerless - ? `${ELASTICSEARCH_SERVERLESS_APIS}group/endpoint-query_rules` - : `${ELASTICSEARCH_APIS}group/endpoint-query_rules`, + ? `${ELASTICSEARCH_SERVERLESS_APIS}group/endpoint-query_rules` + : `${ELASTICSEARCH_APIS}group/endpoint-query_rules`, }, }); }; From ba94116b14330832d74ba37bc18ce9d3221f023f Mon Sep 17 00:00:00 2001 From: lcawl Date: Fri, 11 Apr 2025 17:14:25 -0700 Subject: [PATCH 3/4] Update messages.test.ts --- .../ml/common/constants/messages.test.ts | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/x-pack/platform/plugins/shared/ml/common/constants/messages.test.ts b/x-pack/platform/plugins/shared/ml/common/constants/messages.test.ts index 4a93a553f6761..a022b88e27fe2 100644 --- a/x-pack/platform/plugins/shared/ml/common/constants/messages.test.ts +++ b/x-pack/platform/plugins/shared/ml/common/constants/messages.test.ts @@ -25,14 +25,14 @@ describe('Constants: Messages parseMessages()', () => { id: 'job_id_valid', status: 'success', text: 'Lowercase alphanumeric (a-z and 0-9) characters, hyphens or underscores, starts and ends with an alphanumeric character, and is no more than 64 characters long.', - url: 'https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/ml-put-job.html#ml-put-job-path-parms', + url: 'https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ml-put-job', }, { heading: 'Detector functions', id: 'detectors_function_not_empty', status: 'success', text: 'Presence of detector functions validated in all detectors.', - url: 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/ml-ad-run-jobs.html#ml-ad-detectors', + url: 'https://www.elastic.co/docs/explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-detectors', }, { bucketSpan: '15m', @@ -40,7 +40,7 @@ describe('Constants: Messages parseMessages()', () => { id: 'success_bucket_span', status: 'success', text: 'Format of "15m" is valid and passed validation checks.', - url: 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/ml-ad-run-jobs.html#ml-ad-bucket-span', + url: 'https://www.elastic.co/docs/explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-bucket-span', }, { heading: 'Time range', @@ -53,7 +53,7 @@ describe('Constants: Messages parseMessages()', () => { id: 'success_mml', status: 'success', text: 'Valid and within the estimated model memory limit.', - url: 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/ml-ad-run-jobs.html#ml-ad-model-memory-limits', + url: 'https://www.elastic.co/docs/explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-model-memory-limits', }, ]); }); @@ -65,14 +65,14 @@ describe('Constants: Messages parseMessages()', () => { status: 'error', heading: 'Job ID', text: 'Job ID is invalid. It can contain lowercase alphanumeric (a-z and 0-9) characters, hyphens or underscores and must start and end with an alphanumeric character.', - url: 'https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/ml-put-job.html#ml-put-job-path-parms', + url: 'https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ml-put-job', }, { heading: 'Detector functions', id: 'detectors_function_not_empty', status: 'success', text: 'Presence of detector functions validated in all detectors.', - url: 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/ml-ad-run-jobs.html#ml-ad-detectors', + url: 'https://www.elastic.co/docs/explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-detectors', }, { bucketSpan: '15m', @@ -80,7 +80,7 @@ describe('Constants: Messages parseMessages()', () => { id: 'bucket_span_valid', status: 'success', text: 'Format of "15m" is valid.', - url: 'https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/ml-put-job.html#put-analysisconfig', + url: 'https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ml-put-job', }, { id: 'skipped_extended_tests', @@ -97,14 +97,14 @@ describe('Constants: Messages parseMessages()', () => { id: 'job_id_valid', status: 'success', text: 'Lowercase alphanumeric (a-z and 0-9) characters, hyphens or underscores, starts and ends with an alphanumeric character, and is no more than 64 characters long.', - url: 'https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/ml-put-job.html#ml-put-job-path-parms', + url: 'https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ml-put-job', }, { heading: 'Detector functions', id: 'detectors_function_not_empty', status: 'success', text: 'Presence of detector functions validated in all detectors.', - url: 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/ml-ad-run-jobs.html#ml-ad-detectors', + url: 'https://www.elastic.co/docs/explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-detectors', }, { id: 'cardinality_model_plot_high', @@ -117,14 +117,14 @@ describe('Constants: Messages parseMessages()', () => { status: 'warning', heading: 'Partition field cardinality', text: 'Cardinality of partition_field "order_id" is above 1000 and might result in high memory usage.', - url: 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/ml-ad-run-jobs.html#ml-ad-cardinality', + url: 'https://www.elastic.co/docs/explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-cardinality', }, { heading: 'Bucket span', id: 'bucket_span_high', status: 'info', text: 'Bucket span is 1 day or more. Be aware that days are considered as UTC days, not local days.', - url: 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/ml-ad-run-jobs.html#ml-ad-bucket-span', + url: 'https://www.elastic.co/docs/explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-bucket-span', }, { bucketSpanCompareFactor: 25, @@ -139,7 +139,7 @@ describe('Constants: Messages parseMessages()', () => { status: 'success', heading: 'Influencer configuration', text: 'Passed the validation checks.', - url: 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/ml-ad-run-jobs.html#ml-ad-influencers', + url: 'https://www.elastic.co/docs/explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-influencers', }, { id: 'half_estimated_mml_greater_than_mml', @@ -147,7 +147,7 @@ describe('Constants: Messages parseMessages()', () => { status: 'warning', heading: 'Model memory limit', text: 'The specified model memory limit is less than half of the estimated model memory limit and will likely hit the hard limit.', - url: 'https://www.elastic.co/guide/en/machine-learning/mocked-test-branch/ml-ad-run-jobs.html#ml-ad-model-memory-limits', + url: 'https://www.elastic.co/docs/explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-model-memory-limits', }, { id: 'missing_summary_count_field_name', From f07bb4704b50f4d8ba92cd5776798fed0f02edd1 Mon Sep 17 00:00:00 2001 From: Robert Jaszczurek Date: Tue, 15 Apr 2025 13:48:17 +0200 Subject: [PATCH 4/4] extract common url parts into variables --- .../ml/common/constants/messages.test.ts | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/x-pack/platform/plugins/shared/ml/common/constants/messages.test.ts b/x-pack/platform/plugins/shared/ml/common/constants/messages.test.ts index a022b88e27fe2..5f6190796a970 100644 --- a/x-pack/platform/plugins/shared/ml/common/constants/messages.test.ts +++ b/x-pack/platform/plugins/shared/ml/common/constants/messages.test.ts @@ -15,6 +15,10 @@ import { nonBasicIssuesMessages, } from './messages.test.mock'; +const BASE_URL_DOCS = 'https://www.elastic.co/docs'; +const BASE_URL_API = `${BASE_URL_DOCS}/api/doc/elasticsearch/operation`; +const BASE_URL_EXPLORE = `${BASE_URL_DOCS}/explore-analyze/machine-learning/anomaly-detection`; + describe('Constants: Messages parseMessages()', () => { const docLinksService = docLinksServiceMock.createStartContract(); @@ -25,14 +29,14 @@ describe('Constants: Messages parseMessages()', () => { id: 'job_id_valid', status: 'success', text: 'Lowercase alphanumeric (a-z and 0-9) characters, hyphens or underscores, starts and ends with an alphanumeric character, and is no more than 64 characters long.', - url: 'https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ml-put-job', + url: `${BASE_URL_API}/operation-ml-put-job`, }, { heading: 'Detector functions', id: 'detectors_function_not_empty', status: 'success', text: 'Presence of detector functions validated in all detectors.', - url: 'https://www.elastic.co/docs/explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-detectors', + url: `${BASE_URL_EXPLORE}/ml-ad-run-jobs#ml-ad-detectors`, }, { bucketSpan: '15m', @@ -40,7 +44,7 @@ describe('Constants: Messages parseMessages()', () => { id: 'success_bucket_span', status: 'success', text: 'Format of "15m" is valid and passed validation checks.', - url: 'https://www.elastic.co/docs/explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-bucket-span', + url: `${BASE_URL_EXPLORE}/ml-ad-run-jobs#ml-ad-bucket-span`, }, { heading: 'Time range', @@ -53,7 +57,7 @@ describe('Constants: Messages parseMessages()', () => { id: 'success_mml', status: 'success', text: 'Valid and within the estimated model memory limit.', - url: 'https://www.elastic.co/docs/explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-model-memory-limits', + url: `${BASE_URL_EXPLORE}/ml-ad-run-jobs#ml-ad-model-memory-limits`, }, ]); }); @@ -65,14 +69,14 @@ describe('Constants: Messages parseMessages()', () => { status: 'error', heading: 'Job ID', text: 'Job ID is invalid. It can contain lowercase alphanumeric (a-z and 0-9) characters, hyphens or underscores and must start and end with an alphanumeric character.', - url: 'https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ml-put-job', + url: `${BASE_URL_API}/operation-ml-put-job`, }, { heading: 'Detector functions', id: 'detectors_function_not_empty', status: 'success', text: 'Presence of detector functions validated in all detectors.', - url: 'https://www.elastic.co/docs/explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-detectors', + url: `${BASE_URL_EXPLORE}/ml-ad-run-jobs#ml-ad-detectors`, }, { bucketSpan: '15m', @@ -80,7 +84,7 @@ describe('Constants: Messages parseMessages()', () => { id: 'bucket_span_valid', status: 'success', text: 'Format of "15m" is valid.', - url: 'https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ml-put-job', + url: `${BASE_URL_API}/operation-ml-put-job`, }, { id: 'skipped_extended_tests', @@ -97,14 +101,14 @@ describe('Constants: Messages parseMessages()', () => { id: 'job_id_valid', status: 'success', text: 'Lowercase alphanumeric (a-z and 0-9) characters, hyphens or underscores, starts and ends with an alphanumeric character, and is no more than 64 characters long.', - url: 'https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ml-put-job', + url: `${BASE_URL_API}/operation-ml-put-job`, }, { heading: 'Detector functions', id: 'detectors_function_not_empty', status: 'success', text: 'Presence of detector functions validated in all detectors.', - url: 'https://www.elastic.co/docs/explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-detectors', + url: `${BASE_URL_EXPLORE}/ml-ad-run-jobs#ml-ad-detectors`, }, { id: 'cardinality_model_plot_high', @@ -117,14 +121,14 @@ describe('Constants: Messages parseMessages()', () => { status: 'warning', heading: 'Partition field cardinality', text: 'Cardinality of partition_field "order_id" is above 1000 and might result in high memory usage.', - url: 'https://www.elastic.co/docs/explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-cardinality', + url: `${BASE_URL_EXPLORE}/ml-ad-run-jobs#ml-ad-cardinality`, }, { heading: 'Bucket span', id: 'bucket_span_high', status: 'info', text: 'Bucket span is 1 day or more. Be aware that days are considered as UTC days, not local days.', - url: 'https://www.elastic.co/docs/explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-bucket-span', + url: `${BASE_URL_EXPLORE}/ml-ad-run-jobs#ml-ad-bucket-span`, }, { bucketSpanCompareFactor: 25, @@ -139,7 +143,7 @@ describe('Constants: Messages parseMessages()', () => { status: 'success', heading: 'Influencer configuration', text: 'Passed the validation checks.', - url: 'https://www.elastic.co/docs/explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-influencers', + url: `${BASE_URL_EXPLORE}/ml-ad-run-jobs#ml-ad-influencers`, }, { id: 'half_estimated_mml_greater_than_mml', @@ -147,7 +151,7 @@ describe('Constants: Messages parseMessages()', () => { status: 'warning', heading: 'Model memory limit', text: 'The specified model memory limit is less than half of the estimated model memory limit and will likely hit the hard limit.', - url: 'https://www.elastic.co/docs/explore-analyze/machine-learning/anomaly-detection/ml-ad-run-jobs#ml-ad-model-memory-limits', + url: `${BASE_URL_EXPLORE}/ml-ad-run-jobs#ml-ad-model-memory-limits`, }, { id: 'missing_summary_count_field_name',