public CopyTo build() { return new CopyTo(Collections.unmodifiableList(copyToBuilders)); } }
private static void validateCopyTo(List<FieldMapper> fieldMappers, Map<String, ObjectMapper> fullPathObjectMappers, FieldTypeLookup fieldTypes) { for (FieldMapper mapper : fieldMappers) { if (mapper.copyTo() != null && mapper.copyTo().copyToFields().isEmpty() == false) { String sourceParent = parentObject(mapper.name()); if (sourceParent != null && fieldTypes.get(sourceParent) != null) { throw new IllegalArgumentException("[copy_to] may not be used to copy from a multi-field: [" + mapper.name() + "]"); } final String sourceScope = getNestedScope(mapper.name(), fullPathObjectMappers); for (String copyTo : mapper.copyTo().copyToFields()) { String copyToParent = parentObject(copyTo); if (copyToParent != null && fieldTypes.get(copyToParent) != null) { throw new IllegalArgumentException("[copy_to] may not be used to copy to a multi-field: [" + copyTo + "]"); } if (fullPathObjectMappers.containsKey(copyTo)) { throw new IllegalArgumentException("Cannot copy to field [" + copyTo + "] since it is mapped as an object"); } final String targetScope = getNestedScope(copyTo, fullPathObjectMappers); checkNestedScopeCompatibility(sourceScope, targetScope); } } } }
copyTo.toXContent(builder, params);
copyTo.toXContent(builder, params);
multiFields.toXContent(builder, params); copyTo.toXContent(builder, params);
copyTo.toXContent(builder, params);
private static void validateCopyTo(List<FieldMapper> fieldMappers, Map<String, ObjectMapper> fullPathObjectMappers, FieldTypeLookup fieldTypes) { for (FieldMapper mapper : fieldMappers) { if (mapper.copyTo() != null && mapper.copyTo().copyToFields().isEmpty() == false) { String sourceParent = parentObject(mapper.name()); if (sourceParent != null && fieldTypes.get(sourceParent) != null) { throw new IllegalArgumentException("[copy_to] may not be used to copy from a multi-field: [" + mapper.name() + "]"); } final String sourceScope = getNestedScope(mapper.name(), fullPathObjectMappers); for (String copyTo : mapper.copyTo().copyToFields()) { String copyToParent = parentObject(copyTo); if (copyToParent != null && fieldTypes.get(copyToParent) != null) { throw new IllegalArgumentException("[copy_to] may not be used to copy to a multi-field: [" + copyTo + "]"); } if (fullPathObjectMappers.containsKey(copyTo)) { throw new IllegalArgumentException("Cannot copy to field [" + copyTo + "] since it is mapped as an object"); } final String targetScope = getNestedScope(copyTo, fullPathObjectMappers); checkNestedScopeCompatibility(sourceScope, targetScope); } } } }
private static void validateCopyTo(List<FieldMapper> fieldMappers, Map<String, ObjectMapper> fullPathObjectMappers, FieldTypeLookup fieldTypes) { for (FieldMapper mapper : fieldMappers) { if (mapper.copyTo() != null && mapper.copyTo().copyToFields().isEmpty() == false) { String sourceParent = parentObject(mapper.name()); if (sourceParent != null && fieldTypes.get(sourceParent) != null) { throw new IllegalArgumentException("[copy_to] may not be used to copy from a multi-field: [" + mapper.name() + "]"); } final String sourceScope = getNestedScope(mapper.name(), fullPathObjectMappers); for (String copyTo : mapper.copyTo().copyToFields()) { String copyToParent = parentObject(copyTo); if (copyToParent != null && fieldTypes.get(copyToParent) != null) { throw new IllegalArgumentException("[copy_to] may not be used to copy to a multi-field: [" + copyTo + "]"); } if (fullPathObjectMappers.containsKey(copyTo)) { throw new IllegalArgumentException("Cannot copy to field [" + copyTo + "] since it is mapped as an object"); } final String targetScope = getNestedScope(copyTo, fullPathObjectMappers); checkNestedScopeCompatibility(sourceScope, targetScope); } } } }
private static void parseObjectOrField(ParseContext context, Mapper mapper) throws IOException { if (mapper instanceof ObjectMapper) { parseObjectOrNested(context, (ObjectMapper) mapper); } else if (mapper instanceof FieldMapper) { FieldMapper fieldMapper = (FieldMapper) mapper; Mapper update = fieldMapper.parse(context); if (update != null) { context.addDynamicMapper(update); } parseCopyFields(context, fieldMapper.copyTo().copyToFields()); } else if (mapper instanceof FieldAliasMapper) { throw new IllegalArgumentException("Cannot write to a field alias [" + mapper.name() + "]."); } else { throw new IllegalStateException("The provided mapper [" + mapper.name() + "] has an unrecognized type [" + mapper.getClass().getSimpleName() + "]."); } }
protected MetadataFieldMapper(String simpleName, MappedFieldType fieldType, MappedFieldType defaultFieldType, Settings indexSettings) { super(simpleName, fieldType, defaultFieldType, indexSettings, MultiFields.empty(), CopyTo.empty()); }
PhraseFieldMapper(PhraseFieldType fieldType, Settings indexSettings) { super(fieldType.name(), fieldType, fieldType, indexSettings, MultiFields.empty(), CopyTo.empty()); }
MetaJoinFieldMapper(String name, MappedFieldType fieldType, Settings indexSettings) { super(name, fieldType, ParentIdFieldMapper.Defaults.FIELD_TYPE, indexSettings, MultiFields.empty(), CopyTo.empty()); }
protected PrefixFieldMapper(PrefixFieldType fieldType, Settings indexSettings) { super(fieldType.name(), fieldType, fieldType, indexSettings, MultiFields.empty(), CopyTo.empty()); }
protected MetadataFieldMapper(String simpleName, MappedFieldType fieldType, MappedFieldType defaultFieldType, Settings indexSettings) { super(simpleName, fieldType, defaultFieldType, indexSettings, MultiFields.empty(), CopyTo.empty()); }
MetaJoinFieldMapper(String name, MappedFieldType fieldType, Settings indexSettings) { super(name, fieldType, ParentIdFieldMapper.Defaults.FIELD_TYPE, indexSettings, MultiFields.empty(), CopyTo.empty()); }
MetaJoinFieldMapper(String name, MappedFieldType fieldType, Settings indexSettings) { super(name, fieldType, ParentIdFieldMapper.Defaults.FIELD_TYPE, indexSettings, MultiFields.empty(), CopyTo.empty()); }
private static void parseObjectOrField(ParseContext context, Mapper mapper) throws IOException { if (mapper instanceof ObjectMapper) { parseObjectOrNested(context, (ObjectMapper) mapper, false); } else { FieldMapper fieldMapper = (FieldMapper)mapper; Mapper update = fieldMapper.parse(context); if (update != null) { context.addDynamicMapper(update); } if (fieldMapper.copyTo() != null) { parseCopyFields(context, fieldMapper.copyTo().copyToFields()); } } }
protected PrefixFieldMapper(PrefixFieldType fieldType, Settings indexSettings) { super(fieldType.name(), fieldType, fieldType, indexSettings, MultiFields.empty(), CopyTo.empty()); }
private static void parseObjectOrField(ParseContext context, Mapper mapper) throws IOException { if (mapper instanceof ObjectMapper) { parseObjectOrNested(context, (ObjectMapper) mapper); } else if (mapper instanceof FieldMapper) { FieldMapper fieldMapper = (FieldMapper) mapper; fieldMapper.parse(context); parseCopyFields(context, fieldMapper.copyTo().copyToFields()); } else if (mapper instanceof FieldAliasMapper) { throw new IllegalArgumentException("Cannot write to a field alias [" + mapper.name() + "]."); } else { throw new IllegalStateException("The provided mapper [" + mapper.name() + "] has an unrecognized type [" + mapper.getClass().getSimpleName() + "]."); } }
public CopyTo build() { return new CopyTo(Collections.unmodifiableList(copyToBuilders)); } }