From ced90891abad4d044ae4be7defa8bece634458ef Mon Sep 17 00:00:00 2001 From: kimchy Date: Sun, 10 Jul 2011 23:41:52 +0300 Subject: [PATCH] Allow to disable automatic date detection, closes #1051. --- .../elasticsearch/index/mapper/object/RootObjectMapper.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/object/RootObjectMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/object/RootObjectMapper.java index c20aaea42f6..a711540f584 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/object/RootObjectMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/object/RootObjectMapper.java @@ -37,6 +37,7 @@ import java.util.List; import java.util.Map; import static org.elasticsearch.common.collect.Lists.*; +import static org.elasticsearch.common.xcontent.support.XContentMapValues.*; import static org.elasticsearch.index.mapper.core.TypeParsers.*; /** @@ -50,7 +51,7 @@ public class RootObjectMapper extends ObjectMapper { DateFieldMapper.Defaults.DATE_TIME_FORMATTER, Joda.forPattern("yyyy/MM/dd HH:mm:ss||yyyy/MM/dd") }; - public static final boolean DATE_DETECTION = false; + public static final boolean DATE_DETECTION = true; } public static class Builder extends ObjectMapper.Builder { @@ -166,7 +167,7 @@ public class RootObjectMapper extends ObjectMapper { ((Builder) builder).add(DynamicTemplate.parse(entry.getKey(), (Map) entry.getValue())); } } else if (fieldName.equals("date_detection")) { - + ((Builder) builder).dateDetection = nodeBooleanValue(fieldNode); } } }