[Index Management] Fix broken mapping doc links (#163660)

This commit is contained in:
ruhshan 2023-08-17 09:31:59 +06:00 committed by GitHub
parent a17e307dc8
commit 1e6a87c704
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 51 additions and 34 deletions

View file

@ -20,7 +20,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
defaultMessage: 'Text',
}),
documentation: {
main: '/text.html',
main: 'text.html',
},
description: () => (
<p>
@ -49,7 +49,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
defaultMessage: 'Match only text',
}),
documentation: {
main: '/text.html#match-only-text-field-type',
main: 'text.html#match-only-text-field-type',
},
description: () => (
<p>
@ -78,7 +78,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
defaultMessage: 'Keyword',
}),
documentation: {
main: '/keyword.html',
main: 'keyword.html',
},
description: () => (
<p>
@ -107,7 +107,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
defaultMessage: 'Constant keyword',
}),
documentation: {
main: '/keyword.html#constant-keyword-field-type',
main: 'keyword.html#constant-keyword-field-type',
},
description: () => (
<p>
@ -127,7 +127,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
defaultMessage: 'Numeric',
}),
documentation: {
main: '/number.html',
main: 'number.html',
},
subTypes: {
label: i18n.translate('xpack.idxMgmt.mappingsEditor.dataType.numericSubtypeDescription', {
@ -290,7 +290,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'date',
documentation: {
main: '/date.html',
main: 'date.html',
},
description: () => (
<p>
@ -307,7 +307,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'date_nanos',
documentation: {
main: '/date_nanos.html',
main: 'date_nanos.html',
},
description: () => (
<p>
@ -336,7 +336,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'binary',
documentation: {
main: '/binary.html',
main: 'binary.html',
},
description: () => (
<p>
@ -353,7 +353,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'ip',
documentation: {
main: '/ip.html',
main: 'ip.html',
},
description: () => (
<p>
@ -382,7 +382,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'boolean',
documentation: {
main: '/boolean.html',
main: 'boolean.html',
},
description: () => (
<p>
@ -403,7 +403,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'range',
documentation: {
main: '/range.html',
main: 'range.html',
},
subTypes: {
label: i18n.translate('xpack.idxMgmt.mappingsEditor.dataType.rangeSubtypeDescription', {
@ -425,7 +425,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'object',
documentation: {
main: '/object.html',
main: 'object.html',
},
description: () => (
<p>
@ -454,7 +454,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'nested',
documentation: {
main: '/nested.html',
main: 'nested.html',
},
description: () => (
<p>
@ -483,7 +483,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'rank_feature',
documentation: {
main: '/rank-feature.html',
main: 'rank-feature.html',
},
description: () => (
<p>
@ -512,7 +512,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'rank_features',
documentation: {
main: '/rank-features.html',
main: 'rank-features.html',
},
description: () => (
<p>
@ -541,7 +541,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'dense_vector',
documentation: {
main: '/dense-vector.html',
main: 'dense-vector.html',
},
description: () => (
<p>
@ -642,7 +642,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'geo_point',
documentation: {
main: '/geo-point.html',
main: 'geo-point.html',
},
description: () => (
<p>
@ -659,7 +659,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'geo_shape',
documentation: {
main: '/geo-shape.html',
main: 'geo-shape.html',
learnMore: '/geo-shape.html#geoshape-indexing-approach',
},
description: () => (
@ -692,7 +692,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'completion',
documentation: {
main: '/search-suggesters.html#completion-suggester',
main: 'search-suggesters.html#completion-suggester',
},
description: () => (
<p>
@ -709,7 +709,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'token_count',
documentation: {
main: '/token-count.html',
main: 'token-count.html',
},
description: () => (
<p>
@ -726,7 +726,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'percolator',
documentation: {
main: '/percolator.html',
main: 'percolator.html',
},
description: () => (
<p>
@ -755,7 +755,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'histogram',
documentation: {
main: '/histogram.html',
main: 'histogram.html',
},
description: () => (
<p>
@ -772,7 +772,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'join',
documentation: {
main: '/parent-join.html',
main: 'parent-join.html',
},
description: () => (
<p>
@ -789,7 +789,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'alias',
documentation: {
main: '/alias.html',
main: 'alias.html',
},
description: () => (
<p>
@ -806,7 +806,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'search_as_you_type',
documentation: {
main: '/search-as-you-type.html',
main: 'search-as-you-type.html',
},
description: () => (
<p>
@ -823,7 +823,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'flattened',
documentation: {
main: '/flattened.html',
main: 'flattened.html',
},
description: () => (
<p>
@ -840,7 +840,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'shape',
documentation: {
main: '/shape.html',
main: 'shape.html',
},
description: () => (
<p>
@ -857,7 +857,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'point',
documentation: {
main: '/point.html',
main: 'point.html',
},
description: () => (
<p>
@ -877,7 +877,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'version',
documentation: {
main: '/version.html',
main: 'version.html',
},
description: () => (
<p>
@ -906,7 +906,7 @@ export const TYPE_DEFINITION: { [key in DataType]: DataTypeDefinition } = {
}),
value: 'wildcard',
documentation: {
main: '/keyword.html#wildcard-field-type',
main: 'keyword.html#wildcard-field-type',
},
description: () => (
<p>

View file

@ -22,6 +22,7 @@ import { CodeEditor } from '@kbn/kibana-react-plugin/public';
import { Forms } from '../../../../../shared_imports';
import { useJsonStep } from './use_json_step';
import { documentationService } from '../../../mappings_editor/shared_imports';
interface Props {
defaultValue?: { [key: string]: any };
@ -65,7 +66,7 @@ export const StepAliases: React.FunctionComponent<Props> = React.memo(
<EuiButtonEmpty
size="s"
flush="right"
href={`${esDocsBase}/indices-aliases.html`}
href={documentationService.getBulkIndexAlias()}
target="_blank"
iconType="help"
>

View file

@ -25,6 +25,8 @@ import {
IndexSettings,
} from '../../../mappings_editor';
import { documentationService } from '../../../mappings_editor/shared_imports';
interface Props {
onChange: (content: Forms.Content) => void;
esDocsBase: string;
@ -90,7 +92,7 @@ export const StepMappings: React.FunctionComponent<Props> = React.memo(
<EuiButtonEmpty
size="s"
flush="right"
href={`${esDocsBase}/mapping.html`}
href={documentationService.getMappingDocumentationLink()}
target="_blank"
iconType="help"
>

View file

@ -22,6 +22,7 @@ import { CodeEditor } from '@kbn/kibana-react-plugin/public';
import { Forms } from '../../../../../shared_imports';
import { useJsonStep } from './use_json_step';
import { documentationService } from '../../../mappings_editor/shared_imports';
interface Props {
onChange: (content: Forms.Content) => void;
@ -65,7 +66,7 @@ export const StepSettings: React.FunctionComponent<Props> = React.memo(
<EuiButtonEmpty
size="s"
flush="right"
href={`${esDocsBase}/index-modules.html#index-modules-settings`}
href={documentationService.getSettingsDocumentationLink()}
target="_blank"
iconType="help"
>

View file

@ -19,6 +19,7 @@ import {
import { ComponentTemplateListItem } from '../../../../../common';
import { Forms } from '../../../../shared_imports';
import { ComponentTemplatesSelector } from '../../component_templates';
import { documentationService } from '../../mappings_editor/shared_imports';
interface Props {
esDocsBase: string;
@ -63,7 +64,7 @@ export const StepComponents = ({ defaultValue, onChange, esDocsBase }: Props) =>
);
const showHeader = state.isLoadingComponents === true || state.components.length > 0;
const docUri = `${esDocsBase}/indices-component-template.html`;
const docUri = documentationService.getIndicesComponentTemplate();
const renderHeader = () => {
if (!showHeader) {

View file

@ -57,6 +57,8 @@ class DocumentationService {
private mappingTypesRemoval: string = '';
private percolate: string = '';
private runtimeFields: string = '';
private indicesComponentTemplate: string = '';
private bulkIndexAlias: string = '';
public setup(docLinks: DocLinksStart): void {
const { links } = docLinks;
@ -107,6 +109,8 @@ class DocumentationService {
this.mappingTypesRemoval = links.elasticsearch.mappingTypesRemoval;
this.percolate = links.query.percolate;
this.runtimeFields = links.runtimeFields.overview;
this.indicesComponentTemplate = links.apis.putComponentTemplate;
this.bulkIndexAlias = links.apis.bulkIndexAlias;
}
public getEsDocsBase() {
@ -137,6 +141,10 @@ class DocumentationService {
return this.indexManagement;
}
public getIndicesComponentTemplate() {
return this.indicesComponentTemplate;
}
public getTypeDocLink = (type: DataType, docType = 'main'): string | undefined => {
const typeDefinition = TYPE_DEFINITION[type];
@ -299,6 +307,10 @@ class DocumentationService {
return this.runtimeFields;
}
public getBulkIndexAlias() {
return this.bulkIndexAlias;
}
public getWellKnownTextLink() {
return 'http://docs.opengeospatial.org/is/12-063r5/12-063r5.html';
}