json-schema-to-es-mapping
Version:
Generate Elastic Search mappings from JSON Schema
22 lines (17 loc) • 367 B
JavaScript
const { MappingBaseType } = require("./base");
const { isDate } = require("./util");
function toDate(obj) {
return isDate(obj) && MappingDate.create(obj).convert();
}
class MappingDate extends MappingBaseType {
get baseType() {
return "date";
}
static create(obj) {
return new MappingDate(obj);
}
}
module.exports = {
toDate,
MappingDate
};