don't xcontent locale if its ROOT for date since its the default

This commit is contained in:
Shay Banon 2013-07-24 12:47:22 +02:00
parent 497032e6e7
commit d67b8f1310

View File

@ -448,7 +448,8 @@ public class DateFieldMapper extends NumberFieldMapper<Long> {
if (timeUnit != Defaults.TIME_UNIT) {
builder.field("numeric_resolution", timeUnit.name().toLowerCase(Locale.ROOT));
}
if (dateTimeFormatter.locale() != null) {
// only serialize locale if needed, ROOT is the default, so no need to serialize that case as well...
if (dateTimeFormatter.locale() != null && dateTimeFormatter.locale() != Locale.ROOT) {
builder.field("locale", dateTimeFormatter.locale());
}
}