当前位置: 首页>>代码示例>>Java>>正文


Java IdFieldMapper类代码示例

本文整理汇总了Java中org.elasticsearch.index.mapper.internal.IdFieldMapper的典型用法代码示例。如果您正苦于以下问题:Java IdFieldMapper类的具体用法?Java IdFieldMapper怎么用?Java IdFieldMapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IdFieldMapper类属于org.elasticsearch.index.mapper.internal包,在下文中一共展示了IdFieldMapper类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: postProcess

import org.elasticsearch.index.mapper.internal.IdFieldMapper; //导入依赖的package包/类
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)));
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:21,代码来源:SingleFieldsVisitor.java

示例2: needsField

import org.elasticsearch.index.mapper.internal.IdFieldMapper; //导入依赖的package包/类
@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;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:13,代码来源:SingleFieldsVisitor.java

示例3: registerBuiltInMetadataMappers

import org.elasticsearch.index.mapper.internal.IdFieldMapper; //导入依赖的package包/类
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;
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-phonetic-eudex,代码行数:16,代码来源:MapperTestUtils.java

示例4: idFieldMapper

import org.elasticsearch.index.mapper.internal.IdFieldMapper; //导入依赖的package包/类
public IdFieldMapper idFieldMapper() {
    return metadataMapper(IdFieldMapper.class);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:4,代码来源:DocumentMapper.java

示例5: randomIndexTemplate

import org.elasticsearch.index.mapper.internal.IdFieldMapper; //导入依赖的package包/类
/**
 * Creates a randomized index template. This template is used to pass in randomized settings on a
 * per index basis. Allows to enable/disable the randomization for number of shards and replicas
 */
private void randomIndexTemplate() throws IOException {

    // TODO move settings for random directory etc here into the index based randomized settings.
    if (cluster().size() > 0) {
        final ImmutableSettings.Builder randomSettingsBuilder = setRandomSettings(getRandom(), ImmutableSettings.builder()).put(
                SETTING_INDEX_SEED, getRandom().nextLong());

        if (randomizeNumberOfShardsAndReplicas()) {
            randomSettingsBuilder.put(SETTING_NUMBER_OF_SHARDS, numberOfShards()).put(SETTING_NUMBER_OF_REPLICAS, numberOfReplicas());
        }
        XContentBuilder mappings = null;
        if (frequently() && randomDynamicTemplates()) {
            mappings = XContentFactory.jsonBuilder().startObject().startObject("_default_");
            if (randomBoolean()) {
                mappings.startObject(IdFieldMapper.NAME).field("index", randomFrom("not_analyzed", "no")).endObject();
            }
            if (randomBoolean()) {
                mappings.startObject(TypeFieldMapper.NAME).field("index", randomFrom("no", "not_analyzed")).endObject();
            }
            if (randomBoolean()) {
                mappings.startObject(TimestampFieldMapper.NAME).field("enabled", randomBoolean()).startObject("fielddata")
                        .field(FieldDataType.FORMAT_KEY, randomFrom("array", "doc_values")).endObject().endObject();
            }
            if (randomBoolean()) {
                mappings.startObject(SizeFieldMapper.NAME).field("enabled", randomBoolean()).endObject();
            }
            if (randomBoolean()) {
                mappings.startObject(AllFieldMapper.NAME).field("auto_boost", true).endObject();
            }
            if (randomBoolean()) {
                mappings.startObject(SourceFieldMapper.NAME).field("compress", randomBoolean()).endObject();
            }
            if (compatibilityVersion().onOrAfter(Version.V_1_3_0)) {
                mappings.startObject(FieldNamesFieldMapper.NAME).startObject("fielddata")
                        .field(FieldDataType.FORMAT_KEY, randomFrom("paged_bytes", "fst", "doc_values")).endObject().endObject();
            }
            mappings.startArray("dynamic_templates")
                    .startObject()
                    .startObject("template-strings")
                    .field("match_mapping_type", "string")
                    .startObject("mapping")
                    .startObject("fielddata")
                    .field(FieldDataType.FORMAT_KEY, randomFrom("paged_bytes", "fst"))
            // unfortunately doc values only work on not_analyzed fields
                    .field(Loading.KEY, randomLoadingValues()).endObject().endObject().endObject().endObject().startObject()
                    .startObject("template-longs").field("match_mapping_type", "long").startObject("mapping").startObject("fielddata")
                    .field(FieldDataType.FORMAT_KEY, randomFrom("array", "doc_values"))
                    .field(Loading.KEY, randomFrom(Loading.LAZY, Loading.EAGER)).endObject().endObject().endObject().endObject()
                    .startObject().startObject("template-doubles").field("match_mapping_type", "double").startObject("mapping")
                    .startObject("fielddata").field(FieldDataType.FORMAT_KEY, randomFrom("array", "doc_values"))
                    .field(Loading.KEY, randomFrom(Loading.LAZY, Loading.EAGER)).endObject().endObject().endObject().endObject()
                    .startObject().startObject("template-geo_points").field("match_mapping_type", "geo_point").startObject("mapping")
                    .startObject("fielddata").field(FieldDataType.FORMAT_KEY, randomFrom("array", "doc_values"))
                    .field(Loading.KEY, randomFrom(Loading.LAZY, Loading.EAGER)).endObject().endObject().endObject().endObject()
                    .endArray();
            mappings.endObject().endObject();
        }

        final PutIndexTemplateRequestBuilder putTemplate = client().admin().indices().preparePutTemplate("random_index_template")
                .setTemplate("*").setOrder(0).setSettings(randomSettingsBuilder);
        if (mappings != null) {
            logger.info("test using _default_ mappings: [{}]", mappings.bytesStream().bytes().toUtf8());
            putTemplate.addMapping("_default_", mappings);
        }
        assertAcked(putTemplate.execute().actionGet());
    }
}
 
开发者ID:salyh,项目名称:elasticsearch-sample-plugin-audit,代码行数:72,代码来源:ElasticsearchIntegrationTest.java


注:本文中的org.elasticsearch.index.mapper.internal.IdFieldMapper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。