if (context.indexCreatedVersion().onOrAfter(Version.V_6_4_0)) { if (fieldType.indexOptions() == IndexOptions.DOCS_AND_FREQS) {
@Override public LegacyDoubleFieldMapper build(BuilderContext context) { if (context.indexCreatedVersion().onOrAfter(Version.V_5_0_0_alpha2)) { throw new IllegalStateException("Cannot use legacy numeric types after 5.0"); } setupFieldType(context); return new LegacyDoubleFieldMapper(name, fieldType, defaultFieldType, ignoreMalformed(context), coerce(context), includeInAll, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo); }
@Override public LegacyLongFieldMapper build(BuilderContext context) { if (context.indexCreatedVersion().onOrAfter(Version.V_5_0_0_alpha2)) { throw new IllegalStateException("Cannot use legacy numeric types after 5.0"); } setupFieldType(context); return new LegacyLongFieldMapper(name, fieldType, defaultFieldType, ignoreMalformed(context), coerce(context), includeInAll, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo); }
protected String buildIndexNameClean(BuilderContext context) { if (context.indexCreatedVersion().onOrAfter(Version.V_2_0_0_beta1)) { return buildFullName(context); } return indexName == null ? name : indexName; }
@Override public BinaryFieldMapper build(BuilderContext context) { setupFieldType(context); ((BinaryFieldType)fieldType).setTryUncompressing(context.indexCreatedVersion().before(Version.V_2_0_0_beta1)); return new BinaryFieldMapper(name, fieldType, defaultFieldType, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo); } }
protected String buildIndexName(BuilderContext context) { if (context.indexCreatedVersion().onOrAfter(Version.V_2_0_0_beta1)) { return buildFullName(context); } String actualIndexName = indexName == null ? name : indexName; return context.path().pathAsText(actualIndexName); }
@Override public UidFieldMapper build(BuilderContext context) { setupFieldType(context); fieldType.setHasDocValues(context.indexCreatedVersion().before(Version.V_2_0_0_beta1)); return new UidFieldMapper(fieldType, defaultFieldType, context.indexSettings()); } }
public Y build(Mapper.BuilderContext context) { // version 5.0 cuts over to LatLonPoint and no longer indexes geohash, or lat/lon separately if (context.indexCreatedVersion().before(LatLonPointFieldMapper.LAT_LON_FIELD_VERSION)) { return buildLegacy(context); } return build(context, name, fieldType, defaultFieldType, context.indexSettings(), null, null, null, multiFieldsBuilder.build(this, context), ignoreMalformed(context), copyTo); }
@Override public LegacyTokenCountFieldMapper build(BuilderContext context) { if (context.indexCreatedVersion().onOrAfter(Version.V_5_0_0_alpha2)) { throw new IllegalStateException("Cannot use legacy numeric types after 5.0"); } setupFieldType(context); return new LegacyTokenCountFieldMapper(name, fieldType, defaultFieldType, ignoreMalformed(context), coerce(context), includeInAll, context.indexSettings(), analyzer, multiFieldsBuilder.build(this, context), copyTo); }
@Override public LegacyIpFieldMapper build(BuilderContext context) { if (context.indexCreatedVersion().onOrAfter(Version.V_5_0_0_alpha2)) { throw new IllegalStateException("Cannot use legacy numeric types after 5.0"); } setupFieldType(context); return new LegacyIpFieldMapper(name, fieldType, defaultFieldType, ignoreMalformed(context), coerce(context), includeInAll, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo); }
static RangeFieldMapper createExtractedRangeFieldBuilder(String name, RangeType rangeType, BuilderContext context) { RangeFieldMapper.Builder builder = new RangeFieldMapper.Builder(name, rangeType, context.indexCreatedVersion()); // For now no doc values, because in processQuery(...) only the Lucene range fields get added: builder.docValues(false); return builder.build(context); }
@Override public LegacyIntegerFieldMapper build(BuilderContext context) { if (context.indexCreatedVersion().onOrAfter(Version.V_5_0_0_alpha2)) { throw new IllegalStateException("Cannot use legacy numeric types after 5.0"); } setupFieldType(context); return new LegacyIntegerFieldMapper(name, fieldType, defaultFieldType, ignoreMalformed(context), coerce(context), includeInAll, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo); } @Override
static RangeFieldMapper createExtractedRangeFieldBuilder(String name, RangeType rangeType, BuilderContext context) { RangeFieldMapper.Builder builder = new RangeFieldMapper.Builder(name, rangeType, context.indexCreatedVersion()); // For now no doc values, because in processQuery(...) only the Lucene range fields get added: builder.docValues(false); return builder.build(context); }
@Override public LegacyShortFieldMapper build(BuilderContext context) { if (context.indexCreatedVersion().onOrAfter(Version.V_5_0_0_alpha2)) { throw new IllegalStateException("Cannot use legacy numeric types after 5.0"); } setupFieldType(context); return new LegacyShortFieldMapper(name, fieldType, defaultFieldType, ignoreMalformed(context), coerce(context), includeInAll, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo); }
@Override public GeoPointFieldMapper build(BuilderContext context) { if (context.indexCreatedVersion().before(Version.V_2_3_0)) { fieldType.setNumericPrecisionStep(GeoPointField.PRECISION_STEP); fieldType.setNumericType(FieldType.LegacyNumericType.LONG); } return super.build(context); } }
@Override public LegacyByteFieldMapper build(BuilderContext context) { if (context.indexCreatedVersion().onOrAfter(Version.V_5_0_0_alpha2)) { throw new IllegalStateException("Cannot use legacy numeric types after 5.0"); } setupFieldType(context); return new LegacyByteFieldMapper(name, fieldType, defaultFieldType, ignoreMalformed(context), coerce(context), includeInAll, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo); }
@Override public LegacyFloatFieldMapper build(BuilderContext context) { if (context.indexCreatedVersion().onOrAfter(Version.V_5_0_0_alpha2)) { throw new IllegalStateException("Cannot use legacy numeric types after 5.0"); } setupFieldType(context); return new LegacyFloatFieldMapper(name, fieldType, defaultFieldType, ignoreMalformed(context), coerce(context), includeInAll, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo); }
@Override public LegacyDateFieldMapper build(BuilderContext context) { if (context.indexCreatedVersion().onOrAfter(Version.V_5_0_0_alpha2)) { throw new IllegalStateException("Cannot use legacy numeric types after 5.0"); } setupFieldType(context); fieldType.setNullValue(nullValue); return new LegacyDateFieldMapper(name, fieldType, defaultFieldType, ignoreMalformed(context), coerce(context), includeInAll, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo); }
protected void setupFieldType(BuilderContext context) { fieldType.setName(buildFullName(context)); if (context.indexCreatedVersion().before(Version.V_5_0_0_alpha1)) { fieldType.setOmitNorms(fieldType.omitNorms() && fieldType.boost() == 1.0f); } if (fieldType.indexAnalyzer() == null && fieldType.tokenized() == false && fieldType.indexOptions() != IndexOptions.NONE) { fieldType.setIndexAnalyzer(Lucene.KEYWORD_ANALYZER); fieldType.setSearchAnalyzer(Lucene.KEYWORD_ANALYZER); } boolean defaultDocValues = defaultDocValues(context.indexCreatedVersion()); defaultFieldType.setHasDocValues(defaultDocValues); if (docValuesSet == false) { fieldType.setHasDocValues(defaultDocValues); } } }
@Override public ParentFieldMapper build(BuilderContext context) { if (context.indexCreatedVersion().onOrAfter(Version.V_6_5_0)) { throw new MapperParsingException("[_parent] field is disabled on indices with a single type. " + "Use a [join] field instead."); } if (parentType == null) { throw new MapperParsingException("[_parent] field mapping must contain the [type] option"); } name = joinField(parentType); setupFieldType(context); return new ParentFieldMapper(createParentJoinFieldMapper(documentType, context), fieldType, parentType, context.indexSettings()); } }