@Override protected void doXContentBody(XContentBuilder builder) throws IOException { super.doXContentBody(builder); if (index != Defaults.INDEX) { builder.field("index", index.name().toLowerCase()); } if (store != Defaults.STORE) { builder.field("store", store.name().toLowerCase()); } if (termVector != Defaults.TERM_VECTOR) { builder.field("term_vector", termVector.name().toLowerCase()); } if (omitNorms != Defaults.OMIT_NORMS) { builder.field("omit_norms", omitNorms); } if (indexOptions != Defaults.INDEX_OPTIONS) { builder.field("index_options", indexOptionToString(indexOptions)); } if (precisionStep != Defaults.PRECISION_STEP) { builder.field("precision_step", precisionStep); } if (fuzzyFactor != Defaults.FUZZY_FACTOR) { builder.field("fuzzy_factor", fuzzyFactor); } if (nullValue != null) { builder.field("null_value", nullValue); } if (includeInAll != null) { builder.field("include_in_all", includeInAll); } }
@Override protected void doXContentBody(XContentBuilder builder, boolean includeDefaults, Params params) throws IOException { super.doXContentBody(builder, includeDefaults, params); if (includeDefaults || precisionStep != Defaults.PRECISION_STEP_64_BIT) { builder.field("precision_step", precisionStep); } builder.field("format", dateTimeFormatter.format()); if (includeDefaults || nullValue != null) { builder.field("null_value", nullValue); } if (includeInAll != null) { builder.field("include_in_all", includeInAll); } else if (includeDefaults) { builder.field("include_in_all", false); } if (includeDefaults || timeUnit != Defaults.TIME_UNIT) { builder.field("numeric_resolution", timeUnit.name().toLowerCase(Locale.ROOT)); } // 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()); } else if (includeDefaults) { if (dateTimeFormatter.locale() == null) { builder.field("locale", Locale.ROOT); } else { builder.field("locale", dateTimeFormatter.locale()); } } }
@Override protected void doXContentBody(XContentBuilder builder) throws IOException { super.doXContentBody(builder); if (precisionStep != Defaults.PRECISION_STEP) { builder.field("precision_step", precisionStep); } if (fuzzyFactor != Defaults.FUZZY_FACTOR) { builder.field("fuzzy_factor", fuzzyFactor); } if (nullValue != null) { builder.field("null_value", nullValue); } if (includeInAll != null) { builder.field("include_in_all", includeInAll); } }
@Override protected void doXContentBody(XContentBuilder builder, boolean includeDefaults, Params params) throws IOException { super.doXContentBody(builder, includeDefaults, params); if (includeDefaults || precisionStep != Defaults.PRECISION_STEP_32_BIT) { builder.field("precision_step", precisionStep); } if (includeDefaults || nullValue != null) { builder.field("null_value", nullValue); } if (includeInAll != null) { builder.field("include_in_all", includeInAll); } else if (includeDefaults) { builder.field("include_in_all", false); } }