• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MapperRegistry类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: newMapperService

import org.elasticsearch.indices.mapper.MapperRegistry; //导入依赖的package包/类
public static MapperService newMapperService(NamedXContentRegistry xContentRegistry, Path tempDir, Settings settings,
        IndicesModule indicesModule) throws IOException {
    Settings.Builder settingsBuilder = Settings.builder()
        .put(Environment.PATH_HOME_SETTING.getKey(), tempDir)
        .put(settings);
    if (settings.get(IndexMetaData.SETTING_VERSION_CREATED) == null) {
        settingsBuilder.put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT);
    }
    Settings finalSettings = settingsBuilder.build();
    MapperRegistry mapperRegistry = indicesModule.getMapperRegistry();
    IndexSettings indexSettings = IndexSettingsModule.newIndexSettings("test", finalSettings);
    IndexAnalyzers indexAnalyzers = createTestAnalysis(indexSettings, finalSettings).indexAnalyzers;
    SimilarityService similarityService = new SimilarityService(indexSettings, Collections.emptyMap());
    return new MapperService(indexSettings,
        indexAnalyzers,
        xContentRegistry,
        similarityService,
        mapperRegistry,
        () -> null);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:MapperTestUtils.java


示例2: MapperService

import org.elasticsearch.indices.mapper.MapperRegistry; //导入依赖的package包/类
public MapperService(IndexSettings indexSettings, IndexAnalyzers indexAnalyzers, NamedXContentRegistry xContentRegistry,
                     SimilarityService similarityService, MapperRegistry mapperRegistry,
                     Supplier<QueryShardContext> queryShardContextSupplier) {
    super(indexSettings);
    this.indexAnalyzers = indexAnalyzers;
    this.fieldTypes = new FieldTypeLookup();
    this.documentParser = new DocumentMapperParser(indexSettings, this, indexAnalyzers, xContentRegistry, similarityService,
            mapperRegistry, queryShardContextSupplier);
    this.indexAnalyzer = new MapperAnalyzerWrapper(indexAnalyzers.getDefaultIndexAnalyzer(), p -> p.indexAnalyzer());
    this.searchAnalyzer = new MapperAnalyzerWrapper(indexAnalyzers.getDefaultSearchAnalyzer(), p -> p.searchAnalyzer());
    this.searchQuoteAnalyzer = new MapperAnalyzerWrapper(indexAnalyzers.getDefaultSearchQuoteAnalyzer(), p -> p.searchQuoteAnalyzer());
    this.mapperRegistry = mapperRegistry;

    this.dynamic = this.indexSettings.getValue(INDEX_MAPPER_DYNAMIC_SETTING);
    defaultMappingSource = "{\"_default_\":{}}";

    if (logger.isTraceEnabled()) {
        logger.trace("using dynamic[{}], default mapping source[{}]", dynamic, defaultMappingSource);
    } else if (logger.isDebugEnabled()) {
        logger.debug("using dynamic[{}]", dynamic);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:23,代码来源:MapperService.java


示例3: testArchiveBrokenIndexSettings

import org.elasticsearch.indices.mapper.MapperRegistry; //导入依赖的package包/类
public void testArchiveBrokenIndexSettings() {
    MetaDataIndexUpgradeService service = new MetaDataIndexUpgradeService(Settings.EMPTY, xContentRegistry(),
            new MapperRegistry(Collections.emptyMap(), Collections.emptyMap()), IndexScopedSettings.DEFAULT_SCOPED_SETTINGS);
    IndexMetaData src = newIndexMeta("foo", Settings.EMPTY);
    IndexMetaData indexMetaData = service.archiveBrokenIndexSettings(src);
    assertSame(indexMetaData, src);

    src = newIndexMeta("foo", Settings.builder().put("index.refresh_interval", "-200").build());
    indexMetaData = service.archiveBrokenIndexSettings(src);
    assertNotSame(indexMetaData, src);
    assertEquals("-200", indexMetaData.getSettings().get("archived.index.refresh_interval"));

    src = newIndexMeta("foo", Settings.builder().put("index.codec", "best_compression1").build());
    indexMetaData = service.archiveBrokenIndexSettings(src);
    assertNotSame(indexMetaData, src);
    assertEquals("best_compression1", indexMetaData.getSettings().get("archived.index.codec"));

    src = newIndexMeta("foo", Settings.builder().put("index.refresh.interval", "-1").build());
    indexMetaData = service.archiveBrokenIndexSettings(src);
    assertNotSame(indexMetaData, src);
    assertEquals("-1", indexMetaData.getSettings().get("archived.index.refresh.interval"));

    src = newIndexMeta("foo", indexMetaData.getSettings()); // double archive?
    indexMetaData = service.archiveBrokenIndexSettings(src);
    assertSame(indexMetaData, src);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:27,代码来源:MetaDataIndexUpgradeServiceTests.java


示例4: testFailUpgrade

import org.elasticsearch.indices.mapper.MapperRegistry; //导入依赖的package包/类
public void testFailUpgrade() {
    MetaDataIndexUpgradeService service = new MetaDataIndexUpgradeService(Settings.EMPTY, xContentRegistry(),
            new MapperRegistry(Collections.emptyMap(), Collections.emptyMap()), IndexScopedSettings.DEFAULT_SCOPED_SETTINGS);
    final IndexMetaData metaData = newIndexMeta("foo", Settings.builder()
        .put(IndexMetaData.SETTING_VERSION_UPGRADED, Version.V_5_0_0_beta1)
        .put(IndexMetaData.SETTING_VERSION_CREATED, Version.fromString("2.4.0"))
        .put(IndexMetaData.SETTING_VERSION_MINIMUM_COMPATIBLE,
        Version.CURRENT.luceneVersion.toString()).build());
    String message = expectThrows(IllegalStateException.class, () -> service.upgradeIndexMetaData(metaData,
        Version.CURRENT.minimumIndexCompatibilityVersion())).getMessage();
    assertEquals(message, "The index [[foo/BOOM]] was created with version [2.4.0] but the minimum compatible version is [5.0.0]." +
        " It should be re-indexed in Elasticsearch 5.x before upgrading to " + Version.CURRENT.toString() + ".");

    IndexMetaData goodMeta = newIndexMeta("foo", Settings.builder()
        .put(IndexMetaData.SETTING_VERSION_UPGRADED, Version.V_5_0_0_beta1)
        .put(IndexMetaData.SETTING_VERSION_CREATED, Version.fromString("5.1.0"))
        .put(IndexMetaData.SETTING_VERSION_MINIMUM_COMPATIBLE,
            Version.CURRENT.luceneVersion.toString()).build());
    service.upgradeIndexMetaData(goodMeta, Version.V_5_0_0.minimumIndexCompatibilityVersion());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:MetaDataIndexUpgradeServiceTests.java


示例5: newMapperService

import org.elasticsearch.indices.mapper.MapperRegistry; //导入依赖的package包/类
public static MapperService newMapperService(Path tempDir, Settings indexSettings, IndicesModule indicesModule) {
    Settings.Builder settingsBuilder = Settings.builder()
        .put("path.home", tempDir)
        .put(indexSettings);
    if (indexSettings.get(IndexMetaData.SETTING_VERSION_CREATED) == null) {
        settingsBuilder.put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT);
    }
    Settings settings = settingsBuilder.build();
    MapperRegistry mapperRegistry = indicesModule.getMapperRegistry();
    return new MapperService(new Index("test"),
        settings,
        newAnalysisService(settings),
        newSimilarityLookupService(settings),
        null,
        mapperRegistry,
        new DynamicArrayFieldMapperBuilderFactoryProvider());
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:18,代码来源:MapperTestUtils.java


示例6: newDocumentMapperParser

import org.elasticsearch.indices.mapper.MapperRegistry; //导入依赖的package包/类
public static DocumentMapperParser newDocumentMapperParser(Settings settings) {
    Settings forcedSettings = Settings.builder()
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .put(settings)
            .build();
    SimilarityLookupService similarityLookupService = newSimilarityLookupService(forcedSettings);
    Map<String, Mapper.TypeParser> mappers = registerBuiltInMappers();
    Map<String, MetadataFieldMapper.TypeParser> metadataMappers = registerBuiltInMetadataMappers();
    MapperRegistry mapperRegistry = new MapperRegistry(mappers, metadataMappers);
    MapperService mapperService = new MapperService(new Index("test"),
            forcedSettings,
            newAnalysisService(forcedSettings),
            similarityLookupService,
            null,
            mapperRegistry);
    return new DocumentMapperParser(
            forcedSettings,
            mapperService,
            newAnalysisService(forcedSettings),
            similarityLookupService,
            null,
            mapperRegistry);
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-opennlp,代码行数:24,代码来源:MapperTestUtils.java


示例7: IndicesService

import org.elasticsearch.indices.mapper.MapperRegistry; //导入依赖的package包/类
public IndicesService(Settings settings, PluginsService pluginsService, NodeEnvironment nodeEnv, NamedXContentRegistry xContentRegistry,
                      ClusterSettings clusterSettings, AnalysisRegistry analysisRegistry,
                      IndexNameExpressionResolver indexNameExpressionResolver,
                      MapperRegistry mapperRegistry, NamedWriteableRegistry namedWriteableRegistry,
                      ThreadPool threadPool, IndexScopedSettings indexScopedSettings, CircuitBreakerService circuitBreakerService,
                      BigArrays bigArrays, ScriptService scriptService, ClusterService clusterService, Client client,
                      MetaStateService metaStateService) {
    super(settings);
    this.threadPool = threadPool;
    this.pluginsService = pluginsService;
    this.nodeEnv = nodeEnv;
    this.xContentRegistry = xContentRegistry;
    this.shardsClosedTimeout = settings.getAsTime(INDICES_SHARDS_CLOSED_TIMEOUT, new TimeValue(1, TimeUnit.DAYS));
    this.analysisRegistry = analysisRegistry;
    this.indexNameExpressionResolver = indexNameExpressionResolver;
    this.indicesRequestCache = new IndicesRequestCache(settings);
    this.indicesQueryCache = new IndicesQueryCache(settings);
    this.mapperRegistry = mapperRegistry;
    this.namedWriteableRegistry = namedWriteableRegistry;
    indexingMemoryController = new IndexingMemoryController(settings, threadPool,
                                                            // ensure we pull an iter with new shards - flatten makes a copy
                                                            () -> Iterables.flatten(this).iterator());
    this.indexScopeSetting = indexScopedSettings;
    this.circuitBreakerService = circuitBreakerService;
    this.bigArrays = bigArrays;
    this.scriptService = scriptService;
    this.clusterService = clusterService;
    this.client = client;
    this.indicesFieldDataCache = new IndicesFieldDataCache(settings, new IndexFieldDataCache.Listener() {
        @Override
        public void onRemoval(ShardId shardId, String fieldName, boolean wasEvicted, long sizeInBytes) {
            assert sizeInBytes >= 0 : "When reducing circuit breaker, it should be adjusted with a number higher or equal to 0 and not [" + sizeInBytes + "]";
            circuitBreakerService.getBreaker(CircuitBreaker.FIELDDATA).addWithoutBreaking(-sizeInBytes);
        }
    });
    this.cleanInterval = INDICES_CACHE_CLEAN_INTERVAL_SETTING.get(settings);
    this.cacheCleaner = new CacheCleaner(indicesFieldDataCache, indicesRequestCache,  logger, threadPool, this.cleanInterval);
    this.metaStateService = metaStateService;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:40,代码来源:IndicesService.java


示例8: DocumentMapperParser

import org.elasticsearch.indices.mapper.MapperRegistry; //导入依赖的package包/类
public DocumentMapperParser(IndexSettings indexSettings, MapperService mapperService, IndexAnalyzers indexAnalyzers,
                            NamedXContentRegistry xContentRegistry, SimilarityService similarityService, MapperRegistry mapperRegistry,
                            Supplier<QueryShardContext> queryShardContextSupplier) {
    this.mapperService = mapperService;
    this.indexAnalyzers = indexAnalyzers;
    this.xContentRegistry = xContentRegistry;
    this.similarityService = similarityService;
    this.queryShardContextSupplier = queryShardContextSupplier;
    this.typeParsers = mapperRegistry.getMapperParsers();
    this.rootTypeParsers = mapperRegistry.getMetadataMapperParsers();
    indexVersionCreated = indexSettings.getIndexVersionCreated();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:DocumentMapperParser.java


示例9: MetaDataIndexUpgradeService

import org.elasticsearch.indices.mapper.MapperRegistry; //导入依赖的package包/类
@Inject
public MetaDataIndexUpgradeService(Settings settings, NamedXContentRegistry xContentRegistry, MapperRegistry mapperRegistry,
        IndexScopedSettings indexScopedSettings) {
    super(settings);
    this.xContentRegistry = xContentRegistry;
    this.mapperRegistry = mapperRegistry;
    this.indexScopedSettings = indexScopedSettings;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:MetaDataIndexUpgradeService.java


示例10: TranslogHandler

import org.elasticsearch.indices.mapper.MapperRegistry; //导入依赖的package包/类
public TranslogHandler(NamedXContentRegistry xContentRegistry, String indexName, Logger logger) {
    super(new ShardId("test", "_na_", 0), null, logger);
    Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build();
    Index index = new Index(indexName, "_na_");
    IndexSettings indexSettings = IndexSettingsModule.newIndexSettings(index, settings);
    NamedAnalyzer defaultAnalyzer = new NamedAnalyzer("default", AnalyzerScope.INDEX, new StandardAnalyzer());
    IndexAnalyzers indexAnalyzers = new IndexAnalyzers(indexSettings, defaultAnalyzer, defaultAnalyzer, defaultAnalyzer, Collections.emptyMap(), Collections.emptyMap());
    SimilarityService similarityService = new SimilarityService(indexSettings, Collections.emptyMap());
    MapperRegistry mapperRegistry = new IndicesModule(Collections.emptyList()).getMapperRegistry();
    mapperService = new MapperService(indexSettings, indexAnalyzers, xContentRegistry, similarityService, mapperRegistry,
            () -> null);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:InternalEngineTests.java


示例11: createCodecService

import org.elasticsearch.indices.mapper.MapperRegistry; //导入依赖的package包/类
private CodecService createCodecService() throws IOException {
    Settings nodeSettings = Settings.builder()
            .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir())
            .build();
    IndexSettings settings = IndexSettingsModule.newIndexSettings("_na", nodeSettings);
    SimilarityService similarityService = new SimilarityService(settings, Collections.emptyMap());
    IndexAnalyzers indexAnalyzers = createTestAnalysis(settings, nodeSettings).indexAnalyzers;
    MapperRegistry mapperRegistry = new MapperRegistry(Collections.emptyMap(), Collections.emptyMap());
    MapperService service = new MapperService(settings, indexAnalyzers, xContentRegistry(), similarityService, mapperRegistry,
            () -> null);
    return new CodecService(service, ESLoggerFactory.getLogger("test"));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:CodecTests.java


示例12: testSeesFieldsFromPlugins

import org.elasticsearch.indices.mapper.MapperRegistry; //导入依赖的package包/类
public void testSeesFieldsFromPlugins() throws IOException {
    IndexService indexService = createIndex("test");
    IndicesModule indicesModule = newTestIndicesModule(
        Collections.emptyMap(),
        Collections.singletonMap("_dummy", new DummyMetadataFieldMapper.TypeParser())
    );
    final MapperRegistry mapperRegistry = indicesModule.getMapperRegistry();
    Supplier<QueryShardContext> queryShardContext = () -> {
        return indexService.newQueryShardContext(0, null, () -> { throw new UnsupportedOperationException(); });
    };
    MapperService mapperService = new MapperService(indexService.getIndexSettings(), indexService.getIndexAnalyzers(),
            indexService.xContentRegistry(), indexService.similarityService(), mapperRegistry, queryShardContext);
    DocumentMapperParser parser = new DocumentMapperParser(indexService.getIndexSettings(), mapperService,
            indexService.getIndexAnalyzers(), indexService.xContentRegistry(), indexService.similarityService(), mapperRegistry,
            queryShardContext);
    String mapping = XContentFactory.jsonBuilder().startObject().startObject("type").endObject().endObject().string();
    DocumentMapper mapper = parser.parse("type", new CompressedXContent(mapping));
    ParsedDocument parsedDocument = mapper.parse("index", "type", "id", new BytesArray("{}"));
    IndexableField[] fields = parsedDocument.rootDoc().getFields(FieldNamesFieldMapper.NAME);
    boolean found = false;
    for (IndexableField f : fields) {
        if ("_dummy".equals(f.stringValue())) {
            found = true;
            break;
        }
    }
    assertTrue("Could not find the dummy field among " + Arrays.toString(fields), found);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:29,代码来源:FieldNamesFieldMapperTests.java


示例13: testUpgrade

import org.elasticsearch.indices.mapper.MapperRegistry; //导入依赖的package包/类
public void testUpgrade() {
    MetaDataIndexUpgradeService service = new MetaDataIndexUpgradeService(Settings.EMPTY, xContentRegistry(),
            new MapperRegistry(Collections.emptyMap(), Collections.emptyMap()), IndexScopedSettings.DEFAULT_SCOPED_SETTINGS);
    IndexMetaData src = newIndexMeta("foo", Settings.builder().put("index.refresh_interval", "-200").build());
    assertFalse(service.isUpgraded(src));
    src = service.upgradeIndexMetaData(src, Version.CURRENT.minimumIndexCompatibilityVersion());
    assertTrue(service.isUpgraded(src));
    assertEquals("-200", src.getSettings().get("archived.index.refresh_interval"));
    assertNull(src.getSettings().get("index.refresh_interval"));
    assertSame(src, service.upgradeIndexMetaData(src, Version.CURRENT.minimumIndexCompatibilityVersion())); // no double upgrade
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:MetaDataIndexUpgradeServiceTests.java


示例14: testIsUpgraded

import org.elasticsearch.indices.mapper.MapperRegistry; //导入依赖的package包/类
public void testIsUpgraded() {
    MetaDataIndexUpgradeService service = new MetaDataIndexUpgradeService(Settings.EMPTY, xContentRegistry(),
            new MapperRegistry(Collections.emptyMap(), Collections.emptyMap()), IndexScopedSettings.DEFAULT_SCOPED_SETTINGS);
    IndexMetaData src = newIndexMeta("foo", Settings.builder().put("index.refresh_interval", "-200").build());
    assertFalse(service.isUpgraded(src));
    Version version = VersionUtils.randomVersionBetween(random(), VersionUtils.getFirstVersion(), VersionUtils.getPreviousVersion());
    src = newIndexMeta("foo", Settings.builder().put(IndexMetaData.SETTING_VERSION_UPGRADED, version).build());
    assertFalse(service.isUpgraded(src));
    src = newIndexMeta("foo", Settings.builder().put(IndexMetaData.SETTING_VERSION_UPGRADED, Version.CURRENT).build());
    assertTrue(service.isUpgraded(src));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:MetaDataIndexUpgradeServiceTests.java


示例15: setup

import org.elasticsearch.indices.mapper.MapperRegistry; //导入依赖的package包/类
@Before
public void setup() {
    indexService = createIndex("test");
    mapperRegistry = new MapperRegistry(
            Collections.singletonMap(Murmur3FieldMapper.CONTENT_TYPE, new Murmur3FieldMapper.TypeParser()),
            Collections.emptyMap());
    Supplier<QueryShardContext> queryShardContext = () -> {
        return indexService.newQueryShardContext(0, null, () -> { throw new UnsupportedOperationException(); });
    };
    parser = new DocumentMapperParser(indexService.getIndexSettings(), indexService.mapperService(), indexService.getIndexAnalyzers(),
            indexService.xContentRegistry(), indexService.similarityService(), mapperRegistry, queryShardContext);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:Murmur3FieldMapperTests.java


示例16: DocumentMapperParser

import org.elasticsearch.indices.mapper.MapperRegistry; //导入依赖的package包/类
public DocumentMapperParser(Settings indexSettings, MapperService mapperService, AnalysisService analysisService,
                            SimilarityLookupService similarityLookupService, ScriptService scriptService,
                            MapperRegistry mapperRegistry,
                            @Nullable DynamicArrayFieldMapperBuilderFactory dynamicArrayFieldMapperBuilderFactory) {
    this.dynamicArrayFieldMapperBuilderFactory = dynamicArrayFieldMapperBuilderFactory;
    this.parseFieldMatcher = new ParseFieldMatcher(indexSettings);
    this.scriptService = scriptService;
    this.mapperService = mapperService;
    this.analysisService = analysisService;
    this.similarityLookupService = similarityLookupService;
    this.typeParsers = mapperRegistry.getMapperParsers();
    this.rootTypeParsers = mapperRegistry.getMetadataMapperParsers();
    indexVersionCreated = Version.indexCreated(indexSettings);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:15,代码来源:DocumentMapperParser.java


示例17: MapperService

import org.elasticsearch.indices.mapper.MapperRegistry; //导入依赖的package包/类
public MapperService(Index index, Settings indexSettings, AnalysisService analysisService,
                     SimilarityLookupService similarityLookupService,
                     ScriptService scriptService, MapperRegistry mapperRegistry,
                     DynamicArrayFieldMapperBuilderFactoryProvider dynamicArrayFieldMapperBuilderFactoryProvider) {
    this(index, new IndexSettingsService(index, indexSettings), analysisService, similarityLookupService, scriptService,
        mapperRegistry, dynamicArrayFieldMapperBuilderFactoryProvider);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:8,代码来源:MapperService.java


示例18: MetaDataIndexUpgradeService

import org.elasticsearch.indices.mapper.MapperRegistry; //导入依赖的package包/类
@Inject
public MetaDataIndexUpgradeService(Settings settings, ScriptService scriptService, MapperRegistry mapperRegistry,
                                   DynamicArrayFieldMapperBuilderFactoryProvider dynamicArrayFieldMapperBuilderFactoryProvider) {
    super(settings);
    this.scriptService = scriptService;
    this.mapperRegistry = mapperRegistry;
    this.dynamicArrayFieldMapperBuilderFactoryProvider = dynamicArrayFieldMapperBuilderFactoryProvider;
    final String pre20HashFunctionName = settings.get(DEPRECATED_SETTING_ROUTING_HASH_FUNCTION, null);
    final boolean hasCustomPre20HashFunction = pre20HashFunctionName != null;
    // the hash function package has changed we replace the two hash functions if their fully qualified name is used.
    if (hasCustomPre20HashFunction) {
        switch (pre20HashFunctionName) {
            case "Simple":
            case "simple":
            case "org.elasticsearch.cluster.routing.operation.hash.simple.SimpleHashFunction":
                pre20HashFunction = SimpleHashFunction.class;
                break;
            case "Djb":
            case "djb":
            case "org.elasticsearch.cluster.routing.operation.hash.djb.DjbHashFunction":
                pre20HashFunction = DjbHashFunction.class;
                break;
            default:
                try {
                    pre20HashFunction = Class.forName(pre20HashFunctionName).asSubclass(HashFunction.class);
                } catch (ClassNotFoundException|NoClassDefFoundError e) {
                    throw new ElasticsearchException("failed to load custom hash function [" + pre20HashFunctionName + "]", e);
                }
        }
    } else {
        pre20HashFunction = DjbHashFunction.class;
    }
    pre20UseType = settings.getAsBoolean(DEPRECATED_SETTING_ROUTING_USE_TYPE, null);
    if (hasCustomPre20HashFunction || pre20UseType != null) {
        logger.warn("Settings [{}] and [{}] are deprecated. Index settings from your old indices have been updated to record the fact that they "
                + "used some custom routing logic, you can now remove these settings from your `elasticsearch.yml` file", DEPRECATED_SETTING_ROUTING_HASH_FUNCTION, DEPRECATED_SETTING_ROUTING_USE_TYPE);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:39,代码来源:MetaDataIndexUpgradeService.java


示例19: newMapper

import org.elasticsearch.indices.mapper.MapperRegistry; //导入依赖的package包/类
public static MapperService newMapper(Settings settings) {
    Settings indexSettings = Settings.builder()
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .put("path.home", System.getProperty("path.home"))
            .put("client.type", "node")
            .put(settings)
            .build();
    Index index = new Index("test");
    Injector parentInjector = new ModulesBuilder()
            .add(new SettingsModule(indexSettings),
                    new EnvironmentModule(new Environment(indexSettings)))
            .createInjector();
    AnalysisModule analysisModule = new AnalysisModule(indexSettings,
            parentInjector.getInstance(IndicesAnalysisService.class));
    new EudexPlugin(settings).onModule(analysisModule);
    Injector injector = new ModulesBuilder().add(new IndexSettingsModule(index, indexSettings),
            new IndexNameModule(index),
            analysisModule)
            .createChildInjector(parentInjector);
    AnalysisService analysisService = injector.getInstance(AnalysisService.class);
    SimilarityLookupService similarityLookupService = new SimilarityLookupService(index, indexSettings);
    Map<String, Mapper.TypeParser> mappers = registerBuiltInMappers();
    Map<String, MetadataFieldMapper.TypeParser> metadataMappers = registerBuiltInMetadataMappers();
    MapperRegistry mapperRegistry = new MapperRegistry(mappers, metadataMappers);
    return new MapperService(new Index("test"),
            indexSettings,
            analysisService,
            similarityLookupService,
            null,
            mapperRegistry);
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-phonetic-eudex,代码行数:32,代码来源:MapperTestUtils.java


示例20: newDocumentMapperParser

import org.elasticsearch.indices.mapper.MapperRegistry; //导入依赖的package包/类
public static DocumentMapperParser newDocumentMapperParser(Settings customSettings, String index) throws IOException {
    Settings settings = Settings.builder()
            .put("path.home", System.getProperty("path.home", "/tmp"))
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .put(customSettings)
            .build();
    Environment environment = new Environment(settings);
    HyphenPlugin hyphenPlugin = new HyphenPlugin();
    AnalysisModule analysisModule = new AnalysisModule(environment, Collections.singletonList(hyphenPlugin));
    IndicesModule indicesModule = new IndicesModule(Collections.emptyList());
    MapperRegistry mapperRegistry = indicesModule.getMapperRegistry();
    AnalysisRegistry analysisRegistry = analysisModule.getAnalysisRegistry();
    IndexMetaData indexMetaData = IndexMetaData.builder(index)
            .settings(settings)
            .numberOfShards(1)
            .numberOfReplicas(1)
            .build();
    IndexSettings indexSettings = new IndexSettings(indexMetaData, settings);
    SimilarityService similarityService = new SimilarityService(indexSettings, SimilarityService.BUILT_IN);
    Map<String, CharFilterFactory> charFilterFactoryMap = analysisRegistry.buildCharFilterFactories(indexSettings);
    Map<String, TokenFilterFactory> tokenFilterFactoryMap = analysisRegistry.buildTokenFilterFactories(indexSettings);
    Map<String, TokenizerFactory> tokenizerFactoryMap = analysisRegistry.buildTokenizerFactories(indexSettings);
    Map<String, AnalyzerProvider<?>> analyzerProviderMap = analysisRegistry.buildAnalyzerFactories(indexSettings);
    IndexAnalyzers indexAnalyzers = analysisRegistry.build(indexSettings, analyzerProviderMap,
            tokenizerFactoryMap, charFilterFactoryMap, tokenFilterFactoryMap);
    MapperService mapperService = new MapperService(indexSettings, indexAnalyzers,
            similarityService, mapperRegistry, null);
    return new DocumentMapperParser(indexSettings,
            mapperService, indexAnalyzers, similarityService, mapperRegistry, null);
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-hyphen,代码行数:31,代码来源:MapperTestUtils.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PageRenderLinkSource类代码示例发布时间:2022-05-23
下一篇:
Java EntityVex类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap