org.elasticsearch.indices.IndicesModule Java Examples
The following examples show how to use
org.elasticsearch.indices.IndicesModule.
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: MapperTestUtils.java From Elasticsearch with Apache License 2.0 | 6 votes |
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()); }
Example #2
Source File: MapperTestUtils.java From crate with Apache License 2.0 | 6 votes |
public static MapperService newMapperService(NamedXContentRegistry xContentRegistry, Path tempDir, Settings settings, IndicesModule indicesModule, String indexName) 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(indexName, finalSettings); IndexAnalyzers indexAnalyzers = createTestAnalysis(indexSettings, finalSettings).indexAnalyzers; return new MapperService(indexSettings, indexAnalyzers, xContentRegistry, mapperRegistry, () -> null); }
Example #3
Source File: ESTestCase.java From crate with Apache License 2.0 | 6 votes |
/** 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; } } )); }
Example #4
Source File: ArrayMapperTest.java From crate with Apache License 2.0 | 6 votes |
/** * create index with type and mapping and validate DocumentMapper serialization */ private DocumentMapper mapper(String indexName, String mapping) throws IOException { IndicesModule indicesModule = new IndicesModule(Collections.singletonList(new MapperPlugin() { @Override public Map<String, Mapper.TypeParser> getMappers() { return Collections.singletonMap(ArrayMapper.CONTENT_TYPE, new ArrayTypeParser()); } })); MapperService mapperService = MapperTestUtils.newMapperService( NamedXContentRegistry.EMPTY, createTempDir(), Settings.EMPTY, indicesModule, indexName ); DocumentMapperParser parser = mapperService.documentMapperParser(); DocumentMapper defaultMapper = parser.parse(TYPE, new CompressedXContent(mapping)); XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); builder.startObject(); defaultMapper.toXContent(builder, ToXContent.EMPTY_PARAMS); builder.endObject(); String rebuildMapping = Strings.toString(builder); return parser.parse(TYPE, new CompressedXContent(rebuildMapping)); }
Example #5
Source File: Elasticsearch6Client.java From presto-connectors with Apache License 2.0 | 5 votes |
static NamedWriteableRegistry getNamedWriteableRegistry() { 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()); return new NamedWriteableRegistry(entries); }
Example #6
Source File: Elasticsearch5Client.java From presto-connectors with Apache License 2.0 | 5 votes |
static NamedWriteableRegistry getNamedWriteableRegistry() { 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()); return new NamedWriteableRegistry(entries); }
Example #7
Source File: MapperTestUtils.java From crate with Apache License 2.0 | 5 votes |
public static MapperService newMapperService(NamedXContentRegistry xContentRegistry, Path tempDir, Settings indexSettings, String indexName) throws IOException { IndicesModule indicesModule = new IndicesModule(Collections.emptyList()); return newMapperService(xContentRegistry, tempDir, indexSettings, indicesModule, indexName); }
Example #8
Source File: TranslogHandler.java From crate with Apache License 2.0 | 5 votes |
public TranslogHandler(NamedXContentRegistry xContentRegistry, IndexSettings indexSettings) { NamedAnalyzer defaultAnalyzer = new NamedAnalyzer("default", AnalyzerScope.INDEX, new StandardAnalyzer()); IndexAnalyzers indexAnalyzers = new IndexAnalyzers(indexSettings, defaultAnalyzer, defaultAnalyzer, defaultAnalyzer, emptyMap(), emptyMap(), emptyMap()); MapperRegistry mapperRegistry = new IndicesModule(emptyList()).getMapperRegistry(); mapperService = new MapperService(indexSettings, indexAnalyzers, xContentRegistry, mapperRegistry, () -> null); }
Example #9
Source File: SQLPlugin.java From Elasticsearch with Apache License 2.0 | 4 votes |
public void onModule(IndicesModule indicesModule) { indicesModule.registerMapper(ArrayMapper.CONTENT_TYPE, new ArrayMapper.TypeParser()); }
Example #10
Source File: MapperTestUtils.java From Elasticsearch with Apache License 2.0 | 4 votes |
public static MapperService newMapperService(Path tempDir, Settings indexSettings) { IndicesModule indicesModule = new IndicesModule(); return newMapperService(tempDir, indexSettings, indicesModule); }
Example #11
Source File: SirenJoinPlugin.java From siren-join with GNU Affero General Public License v3.0 | 4 votes |
public void onModule(IndicesModule module) { module.registerQueryParser(FieldDataTermsQueryParser.class); module.registerQueryParser(TermsEnumTermsQueryParser.class); }
Example #12
Source File: OntologyUpdatePlugin.java From BioSolr with Apache License 2.0 | 4 votes |
public void onModule(IndicesModule indicesModule) { indicesModule.registerMapper(OntologyMapper.CONTENT_TYPE, new OntologyMapper.TypeParser()); }
Example #13
Source File: OntologyUpdatePlugin.java From BioSolr with Apache License 2.0 | 4 votes |
public void onModule(IndicesModule indicesModule) { indicesModule.registerMapper(OntologyMapper.CONTENT_TYPE, new OntologyMapper.TypeParser()); }