Skip to content

Commit 73fdbd6

Browse files
committed
Test importing from data/public and casting to ES Field Types.
1 parent 0ba8ea0 commit 73fdbd6

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/plugins/kibana_utils/public/field_mapping/mapping_setup.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,19 @@ import { ES_FIELD_TYPES } from '../../../data/public';
2424
/** @private */
2525
type ShorthandFieldMapObject = FieldMappingSpec | ES_FIELD_TYPES | 'json';
2626

27-
const json: FieldMappingSpec = {
28-
type: 'text' as ES_FIELD_TYPES,
29-
_serialize(v) {
30-
if (v) return JSON.stringify(v);
31-
},
32-
_deserialize(v) {
33-
if (v) return JSON.parse(v);
34-
},
35-
};
36-
3727
/** @public */
3828
export const expandShorthand = (sh: Record<string, ShorthandFieldMapObject>): MappingObject => {
3929
return mapValues<Record<string, ShorthandFieldMapObject>>(sh, (val: ShorthandFieldMapObject) => {
4030
const fieldMap = isString(val) ? { type: val } : val;
31+
const json: FieldMappingSpec = {
32+
type: ES_FIELD_TYPES.TEXT,
33+
_serialize(v) {
34+
if (v) return JSON.stringify(v);
35+
},
36+
_deserialize(v) {
37+
if (v) return JSON.parse(v);
38+
},
39+
};
4140

4241
return fieldMap.type === 'json' ? json : fieldMap;
4342
}) as MappingObject;

0 commit comments

Comments
 (0)