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

The following examples show how to use org.elasticsearch.index.mapper.internal.IdFieldMapper. 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: SingleFieldsVisitor.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
public void postProcess(MappedFieldType fieldType) {
    if (uid != null) {
        switch (field) {
            case UidFieldMapper.NAME: addValue(field, uid.toString());
            case IdFieldMapper.NAME: addValue(field, uid.id());
            case TypeFieldMapper.NAME: addValue(field, uid.type());
        }
    }

    if (fieldsValues == null) {
        return;
    }
    List<Object> fieldValues = fieldsValues.get(fieldType.names().indexName());
    if (fieldValues == null) {
        return;
    }
    for (int i = 0; i < fieldValues.size(); i++) {
        fieldValues.set(i, fieldType.valueForSearch(fieldValues.get(i)));
    }
}
 
Example #2
Source File: SingleFieldsVisitor.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public Status needsField(FieldInfo fieldInfo) throws IOException {
    if (fieldInfo.name.equals(field)) {
        return Status.YES;
    }
    if (fieldInfo.name.equals(UidFieldMapper.NAME)) {
        if (TypeFieldMapper.NAME.equals(field) || IdFieldMapper.NAME.equals(field)) {
            return Status.YES;
        }
    }
    return Status.NO;
}
 
Example #3
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 #4
Source File: DocumentMapper.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public IdFieldMapper idFieldMapper() {
    return metadataMapper(IdFieldMapper.class);
}