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

Java IndicesModule类代码示例

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

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



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

示例1: newMapperService

import org.elasticsearch.indices.IndicesModule; //导入依赖的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: newTestIndicesModule

import org.elasticsearch.indices.IndicesModule; //导入依赖的package包/类
/** Creates an IndicesModule for testing with the given mappers and metadata mappers. */
public static IndicesModule newTestIndicesModule(Map<String, Mapper.TypeParser> extraMappers,
                                                 Map<String, MetadataFieldMapper.TypeParser> extraMetadataMappers) {
    return new IndicesModule(Collections.singletonList(
        new MapperPlugin() {
            @Override
            public Map<String, Mapper.TypeParser> getMappers() {
                return extraMappers;
            }
            @Override
            public Map<String, MetadataFieldMapper.TypeParser> getMetadataMappers() {
                return extraMetadataMappers;
            }
        }
    ));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:ESTestCase.java


示例3: setUp

import org.elasticsearch.indices.IndicesModule; //导入依赖的package包/类
/**
 * Setup for the whole base test class.
 */
@Override
public void setUp() throws Exception {
    super.setUp();
    Settings settings = Settings.builder()
        .put("node.name", AbstractQueryTestCase.class.toString())
        .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir())
        .build();
    IndicesModule indicesModule = new IndicesModule(Collections.emptyList());
    SearchModule searchModule = new SearchModule(settings, false, emptyList());
    List<NamedWriteableRegistry.Entry> entries = new ArrayList<>();
    entries.addAll(indicesModule.getNamedWriteables());
    entries.addAll(searchModule.getNamedWriteables());
    namedWriteableRegistry = new NamedWriteableRegistry(entries);
    xContentRegistry = new NamedXContentRegistry(searchModule.getNamedXContents());
    //create some random type with some default field, those types will stick around for all of the subclasses
    currentTypes = new String[randomIntBetween(0, 5)];
    for (int i = 0; i < currentTypes.length; i++) {
        String type = randomAsciiOfLengthBetween(1, 10);
        currentTypes[i] = type;
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:25,代码来源:BasePipelineAggregationTestCase.java


示例4: setUp

import org.elasticsearch.indices.IndicesModule; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
    super.setUp();
    settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()).build();
    indicesQueryCache = new IndicesQueryCache(settings);
    indexSettings = IndexSettingsModule.newIndexSettings("foo", settings);
    index = indexSettings.getIndex();
    environment = new Environment(settings);
    threadPool = new TestThreadPool("test");
    circuitBreakerService = new NoneCircuitBreakerService();
    bigArrays = new BigArrays(settings, circuitBreakerService);
    ScriptEngineRegistry scriptEngineRegistry = new ScriptEngineRegistry(emptyList());
    ScriptContextRegistry scriptContextRegistry = new ScriptContextRegistry(Collections.emptyList());
    ScriptSettings scriptSettings = new ScriptSettings(scriptEngineRegistry, scriptContextRegistry);
    scriptService = new ScriptService(settings, environment, new ResourceWatcherService(settings, threadPool), scriptEngineRegistry,
            scriptContextRegistry, scriptSettings);
    clusterService = ClusterServiceUtils.createClusterService(threadPool);
    nodeEnvironment = new NodeEnvironment(settings, environment);
    mapperRegistry = new IndicesModule(Collections.emptyList()).getMapperRegistry();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:22,代码来源:IndexModuleTests.java


示例5: testNoParentNullFieldCreatedIfNoParentSpecified

import org.elasticsearch.indices.IndicesModule; //导入依赖的package包/类
public void testNoParentNullFieldCreatedIfNoParentSpecified() throws Exception {
    Index index = new Index("_index", "testUUID");
    IndexSettings indexSettings = IndexSettingsModule.newIndexSettings(index, Settings.EMPTY);
    NamedAnalyzer namedAnalyzer = new NamedAnalyzer("default", AnalyzerScope.INDEX, new StandardAnalyzer());
    IndexAnalyzers indexAnalyzers = new IndexAnalyzers(indexSettings, namedAnalyzer, namedAnalyzer, namedAnalyzer,
        Collections.emptyMap(), Collections.emptyMap());
    SimilarityService similarityService = new SimilarityService(indexSettings, Collections.emptyMap());
    MapperService mapperService = new MapperService(indexSettings, indexAnalyzers, xContentRegistry(), similarityService,
        new IndicesModule(emptyList()).getMapperRegistry(), () -> null);
    XContentBuilder mappingSource = jsonBuilder().startObject().startObject("some_type")
        .startObject("properties")
        .endObject()
        .endObject().endObject();
    mapperService.merge("some_type", new CompressedXContent(mappingSource.string()), MergeReason.MAPPING_UPDATE, false);
    Set<String> allFields = new HashSet<>(mapperService.simpleMatchToIndexNames("*"));
    assertTrue(allFields.contains("_parent"));
    assertFalse(allFields.contains("_parent#null"));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:19,代码来源:ParentFieldMapperTests.java


示例6: newMapperService

import org.elasticsearch.indices.IndicesModule; //导入依赖的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


示例7: setUp

import org.elasticsearch.indices.IndicesModule; //导入依赖的package包/类
public void setUp() throws Exception {
    super.setUp();
    IndicesModule indicesModule = new IndicesModule(Collections.emptyList());
    searchExtPlugin = new TestSearchExtPlugin();
    SearchModule searchModule = new SearchModule(Settings.EMPTY, false, Collections.singletonList(searchExtPlugin));
    List<NamedWriteableRegistry.Entry> entries = new ArrayList<>();
    entries.addAll(indicesModule.getNamedWriteables());
    entries.addAll(searchModule.getNamedWriteables());
    namedWriteableRegistry = new NamedWriteableRegistry(entries);
    xContentRegistry = new NamedXContentRegistry(searchModule.getNamedXContents());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:AbstractSearchTestCase.java


示例8: TranslogHandler

import org.elasticsearch.indices.IndicesModule; //导入依赖的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


示例9: testSeesFieldsFromPlugins

import org.elasticsearch.indices.IndicesModule; //导入依赖的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


示例10: setUp

import org.elasticsearch.indices.IndicesModule; //导入依赖的package包/类
public void setUp() throws Exception {
    super.setUp();
    IndicesModule indicesModule = new IndicesModule(Collections.emptyList());
    SearchModule searchModule = new SearchModule(Settings.EMPTY, false, Collections.emptyList());
    List<NamedWriteableRegistry.Entry> entries = new ArrayList<>();
    entries.addAll(indicesModule.getNamedWriteables());
    entries.addAll(searchModule.getNamedWriteables());
    namedWriteableRegistry = new NamedWriteableRegistry(entries);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:ExplainRequestTests.java


示例11: newDocumentMapperParser

import org.elasticsearch.indices.IndicesModule; //导入依赖的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


示例12: newDocumentMapperParser

import org.elasticsearch.indices.IndicesModule; //导入依赖的package包/类
public static DocumentMapperParser newDocumentMapperParser(Settings customSettings, String index) throws IOException {
    Settings settings = Settings.builder()
            .put("path.home", System.getProperty("path.home", System.getProperty("user.dir")))
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .put(customSettings)
            .build();
    Environment environment = new Environment(settings);
    ReferencePlugin referencePlugin = new ReferencePlugin();
    AnalysisModule analysisModule = new AnalysisModule(environment, Collections.emptyList());
    IndicesModule indicesModule = new IndicesModule(Collections.singletonList(referencePlugin));
    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);
    Map<String, AnalyzerProvider<?>> normalizerProviderMap = analysisRegistry.buildNormalizerFactories(indexSettings);
    IndexAnalyzers indexAnalyzers = analysisRegistry.build(indexSettings,
            analyzerProviderMap,
            normalizerProviderMap,
            tokenizerFactoryMap,
            charFilterFactoryMap,
            tokenFilterFactoryMap);
    MapperService mapperService = new MapperService(indexSettings, indexAnalyzers, NamedXContentRegistry.EMPTY,
            similarityService, mapperRegistry, null);
    return new DocumentMapperParser(indexSettings, mapperService, indexAnalyzers, NamedXContentRegistry.EMPTY,
            similarityService, mapperRegistry, null);
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-reference,代码行数:36,代码来源:MapperTestUtils.java


示例13: newDocumentMapperParser

import org.elasticsearch.indices.IndicesModule; //导入依赖的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);
    BundlePlugin bundlePlugin = new BundlePlugin(settings);
    AnalysisModule analysisModule = new AnalysisModule(environment, Collections.singletonList(bundlePlugin));
    IndicesModule indicesModule = new IndicesModule(Collections.singletonList(bundlePlugin));
    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);
    Map<String, AnalyzerProvider<?>> normalizerProviderMap = analysisRegistry.buildNormalizerFactories(indexSettings);
    IndexAnalyzers indexAnalyzers = analysisRegistry.build(indexSettings,
            analyzerProviderMap,
            normalizerProviderMap,
            tokenizerFactoryMap,
            charFilterFactoryMap,
            tokenFilterFactoryMap);
    MapperService mapperService = new MapperService(indexSettings, indexAnalyzers, NamedXContentRegistry.EMPTY,
            similarityService, mapperRegistry, null);
    return new DocumentMapperParser(indexSettings, mapperService, indexAnalyzers, NamedXContentRegistry.EMPTY,
            similarityService, mapperRegistry, null);
}
 
开发者ID:jprante,项目名称:elasticsearch-plugin-bundle,代码行数:36,代码来源:MapperTestUtils.java


示例14: onModule

import org.elasticsearch.indices.IndicesModule; //导入依赖的package包/类
public void onModule(IndicesModule indicesModule) {
    indicesModule.registerMapper(ArrayMapper.CONTENT_TYPE, new ArrayMapper.TypeParser());
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:4,代码来源:SQLPlugin.java


示例15: onModule

import org.elasticsearch.indices.IndicesModule; //导入依赖的package包/类
public void onModule(IndicesModule indicesModule) {
    indicesModule.registerMapper(ImageMapper.CONTENT_TYPE, new ImageMapper.TypeParser(new ThreadPool(ImageMapper.CONTENT_TYPE)));
    indicesModule.registerQueryParser(ImageQueryParser.class);
}
 
开发者ID:usc-isi-i2,项目名称:elasticsearch-image-features,代码行数:5,代码来源:ImagePlugin.java


示例16: onModule

import org.elasticsearch.indices.IndicesModule; //导入依赖的package包/类
public void onModule(IndicesModule module) {
    module.registerQueryParser(FilterDemoParser.class);
}
 
开发者ID:chensed,项目名称:my-first-github,代码行数:4,代码来源:FilterDemoPlugin.java


示例17: onModule

import org.elasticsearch.indices.IndicesModule; //导入依赖的package包/类
public void onModule(IndicesModule module) {
  module.registerQueryParser(FieldDataTermsQueryParser.class);
  module.registerQueryParser(TermsEnumTermsQueryParser.class);
}
 
开发者ID:sirensolutions,项目名称:siren-join,代码行数:5,代码来源:SirenJoinPlugin.java


示例18: onModule

import org.elasticsearch.indices.IndicesModule; //导入依赖的package包/类
public void onModule(IndicesModule module) {
    module.registerQueryParser(ArmorWrapperQueryParser.class);
}
 
开发者ID:petalmd,项目名称:armor,代码行数:4,代码来源:ArmorPlugin.java


示例19: onModule

import org.elasticsearch.indices.IndicesModule; //导入依赖的package包/类
public void onModule(IndicesModule indicesModule) {
	indicesModule.registerMapper(OntologyMapper.CONTENT_TYPE, new OntologyMapper.TypeParser());
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:4,代码来源:OntologyUpdatePlugin.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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