Skip to content

Commit

Permalink
[7.7] [Mappings Editor] Add logic for including type name in e… (elas…
Browse files Browse the repository at this point in the history
  • Loading branch information
jloleysens authored Apr 3, 2020
1 parent 671b444 commit 4973ddd
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -24,6 +24,9 @@ import { serializers } from '../../../../shared_imports';

import { serializeTemplate } from '../../../../../common/lib/template_serialization';
import { Template } from '../../../../../common/types';

import { doMappingsHaveType } from '../../mappings_editor/lib';

import { StepProps } from '../types';

const { stripEmptyFields } = serializers;
@@ -159,7 +162,10 @@ export const StepReview: React.FunctionComponent<StepProps> = ({ template, updat
);

const RequestTab = () => {
const endpoint = `PUT _template/${name || '<templateName>'}`;
const includeTypeName = doMappingsHaveType(template.mappings);
const endpoint = `PUT _template/${name || '<templateName>'}${
includeTypeName ? '?include_type_name' : ''
}`;
const templateString = JSON.stringify(serializedTemplate, null, 2);
const request = `${endpoint}\n${templateString}`;

0 comments on commit 4973ddd

Please sign in to comment.