Search in sources :

Example 1 with IndicesModule

use of org.elasticsearch.indices.IndicesModule in project elasticsearch by elastic.

the class ExplainRequestTests method setUp.

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);
}
Also used : NamedWriteableRegistry(org.elasticsearch.common.io.stream.NamedWriteableRegistry) IndicesModule(org.elasticsearch.indices.IndicesModule) ArrayList(java.util.ArrayList) SearchModule(org.elasticsearch.search.SearchModule)

Example 2 with IndicesModule

use of org.elasticsearch.indices.IndicesModule in project elasticsearch by elastic.

the class IndexModuleTests method setUp.

@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();
}
Also used : IndicesQueryCache(org.elasticsearch.indices.IndicesQueryCache) ScriptService(org.elasticsearch.script.ScriptService) BigArrays(org.elasticsearch.common.util.BigArrays) IndicesModule(org.elasticsearch.indices.IndicesModule) ScriptSettings(org.elasticsearch.script.ScriptSettings) NodeEnvironment(org.elasticsearch.env.NodeEnvironment) ScriptEngineRegistry(org.elasticsearch.script.ScriptEngineRegistry) Environment(org.elasticsearch.env.Environment) NodeEnvironment(org.elasticsearch.env.NodeEnvironment) TestThreadPool(org.elasticsearch.threadpool.TestThreadPool) ResourceWatcherService(org.elasticsearch.watcher.ResourceWatcherService) ScriptContextRegistry(org.elasticsearch.script.ScriptContextRegistry) NoneCircuitBreakerService(org.elasticsearch.indices.breaker.NoneCircuitBreakerService)

Example 3 with IndicesModule

use of org.elasticsearch.indices.IndicesModule in project elasticsearch by elastic.

the class ParentFieldMapperTests method testNoParentNullFieldCreatedIfNoParentSpecified.

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"));
}
Also used : IndicesModule(org.elasticsearch.indices.IndicesModule) NamedAnalyzer(org.elasticsearch.index.analysis.NamedAnalyzer) IndexSettings(org.elasticsearch.index.IndexSettings) Index(org.elasticsearch.index.Index) StandardAnalyzer(org.apache.lucene.analysis.standard.StandardAnalyzer) SimilarityService(org.elasticsearch.index.similarity.SimilarityService) CompressedXContent(org.elasticsearch.common.compress.CompressedXContent) IndexAnalyzers(org.elasticsearch.index.analysis.IndexAnalyzers) XContentBuilder(org.elasticsearch.common.xcontent.XContentBuilder) HashSet(java.util.HashSet)

Example 4 with IndicesModule

use of org.elasticsearch.indices.IndicesModule in project elasticsearch by elastic.

the class BaseAggregationTestCase method setUp.

/**
     * 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;
    }
}
Also used : NamedWriteableRegistry(org.elasticsearch.common.io.stream.NamedWriteableRegistry) IndicesModule(org.elasticsearch.indices.IndicesModule) ArrayList(java.util.ArrayList) SearchModule(org.elasticsearch.search.SearchModule) NamedXContentRegistry(org.elasticsearch.common.xcontent.NamedXContentRegistry) Settings(org.elasticsearch.common.settings.Settings) AbstractQueryTestCase(org.elasticsearch.test.AbstractQueryTestCase)

Example 5 with IndicesModule

use of org.elasticsearch.indices.IndicesModule in project elasticsearch by elastic.

the class AbstractSearchTestCase method setUp.

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());
}
Also used : NamedWriteableRegistry(org.elasticsearch.common.io.stream.NamedWriteableRegistry) IndicesModule(org.elasticsearch.indices.IndicesModule) ArrayList(java.util.ArrayList) NamedXContentRegistry(org.elasticsearch.common.xcontent.NamedXContentRegistry)

Aggregations

IndicesModule (org.elasticsearch.indices.IndicesModule)10 ArrayList (java.util.ArrayList)5 NamedWriteableRegistry (org.elasticsearch.common.io.stream.NamedWriteableRegistry)5 SearchModule (org.elasticsearch.search.SearchModule)4 CompressedXContent (org.elasticsearch.common.compress.CompressedXContent)3 NamedXContentRegistry (org.elasticsearch.common.xcontent.NamedXContentRegistry)3 Settings (org.elasticsearch.common.settings.Settings)2 XContentBuilder (org.elasticsearch.common.xcontent.XContentBuilder)2 MapperService (org.elasticsearch.index.mapper.MapperService)2 AbstractQueryTestCase (org.elasticsearch.test.AbstractQueryTestCase)2 HashSet (java.util.HashSet)1 StandardAnalyzer (org.apache.lucene.analysis.standard.StandardAnalyzer)1 IndexableField (org.apache.lucene.index.IndexableField)1 BytesArray (org.elasticsearch.common.bytes.BytesArray)1 BigArrays (org.elasticsearch.common.util.BigArrays)1 Environment (org.elasticsearch.env.Environment)1 NodeEnvironment (org.elasticsearch.env.NodeEnvironment)1 Index (org.elasticsearch.index.Index)1 IndexService (org.elasticsearch.index.IndexService)1 IndexSettings (org.elasticsearch.index.IndexSettings)1