org.elasticsearch.index.mapper.internal.SourceFieldMapper Java Examples

The following examples show how to use org.elasticsearch.index.mapper.internal.SourceFieldMapper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CollectorFieldsVisitor.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public Status needsField(FieldInfo fieldInfo) throws IOException {
    if (SourceFieldMapper.NAME.equals(fieldInfo.name)) {
        return Status.YES;
    }
    return requiredFields.contains(fieldInfo.name) ? Status.YES : Status.NO;
}
 
Example #2
Source File: FieldsVisitor.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void binaryField(FieldInfo fieldInfo, byte[] value) throws IOException {
    if (SourceFieldMapper.NAME.equals(fieldInfo.name)) {
        source = new BytesArray(value);
    } else {
        addValue(fieldInfo.name, new BytesRef(value));
    }
}
 
Example #3
Source File: FieldsVisitor.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
public void reset() {
    if (fieldsValues != null) fieldsValues.clear();
    source = null;
    uid = null;

    requiredFields.addAll(BASE_REQUIRED_FIELDS);
    if (loadSource) {
        requiredFields.add(SourceFieldMapper.NAME);
    }
}
 
Example #4
Source File: MapperTestUtils.java    From elasticsearch-analysis-baseform with Apache License 2.0 5 votes vote down vote up
private static Map<String, MetadataFieldMapper.TypeParser> registerBuiltInMetadataMappers() {
    Map<String, MetadataFieldMapper.TypeParser> metadataMapperParsers = new LinkedHashMap<>();
    metadataMapperParsers.put(UidFieldMapper.NAME, new UidFieldMapper.TypeParser());
    metadataMapperParsers.put(IdFieldMapper.NAME, new IdFieldMapper.TypeParser());
    metadataMapperParsers.put(RoutingFieldMapper.NAME, new RoutingFieldMapper.TypeParser());
    metadataMapperParsers.put(IndexFieldMapper.NAME, new IndexFieldMapper.TypeParser());
    metadataMapperParsers.put(SourceFieldMapper.NAME, new SourceFieldMapper.TypeParser());
    metadataMapperParsers.put(TypeFieldMapper.NAME, new TypeFieldMapper.TypeParser());
    metadataMapperParsers.put(AllFieldMapper.NAME, new AllFieldMapper.TypeParser());
    metadataMapperParsers.put(TimestampFieldMapper.NAME, new TimestampFieldMapper.TypeParser());
    metadataMapperParsers.put(TTLFieldMapper.NAME, new TTLFieldMapper.TypeParser());
    metadataMapperParsers.put(VersionFieldMapper.NAME, new VersionFieldMapper.TypeParser());
    metadataMapperParsers.put(ParentFieldMapper.NAME, new ParentFieldMapper.TypeParser());
    return metadataMapperParsers;
}
 
Example #5
Source File: DocumentMapper.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public SourceFieldMapper sourceMapper() {
    return metadataMapper(SourceFieldMapper.class);
}