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


Java MapperService.docMappers方法代码示例

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

在下文中一共展示了MapperService.docMappers方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: ParentChildIndexFieldData

import org.elasticsearch.index.mapper.MapperService; //导入方法依赖的package包/类
public ParentChildIndexFieldData(Index index, Settings indexSettings, MappedFieldType.Names fieldNames,
                                 FieldDataType fieldDataType, IndexFieldDataCache cache, MapperService mapperService,
                                 CircuitBreakerService breakerService) {
    super(index, indexSettings, fieldNames, fieldDataType, cache);
    this.breakerService = breakerService;
    if (Version.indexCreated(indexSettings).before(Version.V_2_0_0_beta1)) {
        parentTypes = new TreeSet<>();
        for (DocumentMapper documentMapper : mapperService.docMappers(false)) {
            beforeCreate(documentMapper);
        }
        mapperService.addTypeListener(this);
    } else {
        ImmutableSortedSet.Builder<String> builder = ImmutableSortedSet.naturalOrder();
        for (DocumentMapper mapper : mapperService.docMappers(false)) {
            ParentFieldMapper parentFieldMapper = mapper.parentFieldMapper();
            if (parentFieldMapper.active()) {
                builder.add(parentFieldMapper.type());
            }
        }
        parentTypes = builder.build();
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:23,代码来源:ParentChildIndexFieldData.java


示例2: ParentChildIndexFieldData

import org.elasticsearch.index.mapper.MapperService; //导入方法依赖的package包/类
public ParentChildIndexFieldData(IndexSettings indexSettings, String fieldName,
                                 IndexFieldDataCache cache, MapperService mapperService,
                                 CircuitBreakerService breakerService) {
    super(indexSettings, fieldName, cache);
    this.breakerService = breakerService;
    Set<String> parentTypes = new HashSet<>();
    for (DocumentMapper mapper : mapperService.docMappers(false)) {
        ParentFieldMapper parentFieldMapper = mapper.parentFieldMapper();
        if (parentFieldMapper.active()) {
            parentTypes.add(parentFieldMapper.type());
        }
    }
    this.parentTypes = parentTypes;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:ParentChildIndexFieldData.java


示例3: warmReader

import org.elasticsearch.index.mapper.MapperService; //导入方法依赖的package包/类
@Override
public IndexWarmer.TerminationHandle warmReader(final IndexShard indexShard, final Engine.Searcher searcher) {
    if (indexSettings.getIndex().equals(indexShard.indexSettings().getIndex()) == false) {
        // this is from a different index
        return TerminationHandle.NO_WAIT;
    }

    if (!loadRandomAccessFiltersEagerly) {
        return TerminationHandle.NO_WAIT;
    }

    boolean hasNested = false;
    final Set<Query> warmUp = new HashSet<>();
    final MapperService mapperService = indexShard.mapperService();
    for (DocumentMapper docMapper : mapperService.docMappers(false)) {
        if (docMapper.hasNestedObjects()) {
            hasNested = true;
            for (ObjectMapper objectMapper : docMapper.objectMappers().values()) {
                if (objectMapper.nested().isNested()) {
                    ObjectMapper parentObjectMapper = docMapper.findParentObjectMapper(objectMapper);
                    if (parentObjectMapper != null && parentObjectMapper.nested().isNested()) {
                        warmUp.add(parentObjectMapper.nestedTypeFilter());
                    }
                }
            }
        }
    }

    if (hasNested) {
        warmUp.add(Queries.newNonNestedFilter());
    }

    final CountDownLatch latch = new CountDownLatch(searcher.reader().leaves().size() * warmUp.size());
    for (final LeafReaderContext ctx : searcher.reader().leaves()) {
        for (final Query filterToWarm : warmUp) {
            executor.execute(() -> {
                try {
                    final long start = System.nanoTime();
                    getAndLoadIfNotPresent(filterToWarm, ctx);
                    if (indexShard.warmerService().logger().isTraceEnabled()) {
                        indexShard.warmerService().logger().trace("warmed bitset for [{}], took [{}]", filterToWarm, TimeValue.timeValueNanos(System.nanoTime() - start));
                    }
                } catch (Exception e) {
                    indexShard.warmerService().logger().warn((Supplier<?>) () -> new ParameterizedMessage("failed to load bitset for [{}]", filterToWarm), e);
                } finally {
                    latch.countDown();
                }
            });
        }
    }
    return () -> latch.await();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:53,代码来源:BitsetFilterCache.java


示例4: warmNewReaders

import org.elasticsearch.index.mapper.MapperService; //导入方法依赖的package包/类
@Override
public IndicesWarmer.TerminationHandle warmNewReaders(final IndexShard indexShard, IndexMetaData indexMetaData, IndicesWarmer.WarmerContext context, ThreadPool threadPool) {
    if (index.getName().equals(context.shardId().getIndex()) == false) {
        // this is from a different index
        return TerminationHandle.NO_WAIT;
    }

    if (!loadRandomAccessFiltersEagerly) {
        return TerminationHandle.NO_WAIT;
    }

    boolean hasNested = false;
    final Set<Query> warmUp = new HashSet<>();
    final MapperService mapperService = indexShard.mapperService();
    for (DocumentMapper docMapper : mapperService.docMappers(false)) {
        if (docMapper.hasNestedObjects()) {
            hasNested = true;
            for (ObjectMapper objectMapper : docMapper.objectMappers().values()) {
                if (objectMapper.nested().isNested()) {
                    ObjectMapper parentObjectMapper = docMapper.findParentObjectMapper(objectMapper);
                    if (parentObjectMapper != null && parentObjectMapper.nested().isNested()) {
                        warmUp.add(parentObjectMapper.nestedTypeFilter());
                    }
                }
            }
        }
    }

    if (hasNested) {
        warmUp.add(Queries.newNonNestedFilter());
    }

    final Executor executor = threadPool.executor(executor());
    final CountDownLatch latch = new CountDownLatch(context.searcher().reader().leaves().size() * warmUp.size());
    for (final LeafReaderContext ctx : context.searcher().reader().leaves()) {
        for (final Query filterToWarm : warmUp) {
            executor.execute(new Runnable() {

                @Override
                public void run() {
                    try {
                        final long start = System.nanoTime();
                        getAndLoadIfNotPresent(filterToWarm, ctx);
                        if (indexShard.warmerService().logger().isTraceEnabled()) {
                            indexShard.warmerService().logger().trace("warmed bitset for [{}], took [{}]", filterToWarm, TimeValue.timeValueNanos(System.nanoTime() - start));
                        }
                    } catch (Throwable t) {
                        indexShard.warmerService().logger().warn("failed to load bitset for [{}]", t, filterToWarm);
                    } finally {
                        latch.countDown();
                    }
                }
            });
        }
    }
    return new TerminationHandle() {
        @Override
        public void awaitTermination() throws InterruptedException {
            latch.await();
        }
    };
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:63,代码来源:BitsetFilterCache.java



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