Search in sources :

Example 16 with SearchModule

use of org.elasticsearch.search.SearchModule in project elasticsearch by elastic.

the class BasePipelineAggregationTestCase 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 17 with SearchModule

use of org.elasticsearch.search.SearchModule in project elasticsearch by elastic.

the class AggregatorFactoriesTests method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    // we have to prefer CURRENT since with the range of versions we support
    // it's rather unlikely to get the current actually.
    Settings settings = Settings.builder().put("node.name", AbstractQueryTestCase.class.toString()).put(Environment.PATH_HOME_SETTING.getKey(), createTempDir()).put(ScriptService.SCRIPT_AUTO_RELOAD_ENABLED_SETTING.getKey(), false).build();
    // 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;
    }
    xContentRegistry = new NamedXContentRegistry(new SearchModule(settings, false, emptyList()).getNamedXContents());
}
Also used : SearchModule(org.elasticsearch.search.SearchModule) Matchers.containsString(org.hamcrest.Matchers.containsString) NamedXContentRegistry(org.elasticsearch.common.xcontent.NamedXContentRegistry) Settings(org.elasticsearch.common.settings.Settings)

Example 18 with SearchModule

use of org.elasticsearch.search.SearchModule in project elasticsearch by elastic.

the class CollapseBuilderTests method init.

@BeforeClass
public static void init() {
    SearchModule searchModule = new SearchModule(Settings.EMPTY, false, emptyList());
    namedWriteableRegistry = new NamedWriteableRegistry(searchModule.getNamedWriteables());
    xContentRegistry = new NamedXContentRegistry(searchModule.getNamedXContents());
}
Also used : NamedWriteableRegistry(org.elasticsearch.common.io.stream.NamedWriteableRegistry) SearchModule(org.elasticsearch.search.SearchModule) NamedXContentRegistry(org.elasticsearch.common.xcontent.NamedXContentRegistry) BeforeClass(org.junit.BeforeClass)

Aggregations

SearchModule (org.elasticsearch.search.SearchModule)18 NamedWriteableRegistry (org.elasticsearch.common.io.stream.NamedWriteableRegistry)15 NamedXContentRegistry (org.elasticsearch.common.xcontent.NamedXContentRegistry)12 BeforeClass (org.junit.BeforeClass)8 ArrayList (java.util.ArrayList)6 Settings (org.elasticsearch.common.settings.Settings)5 IndicesModule (org.elasticsearch.indices.IndicesModule)4 Version (org.elasticsearch.Version)2 DiscoveryNode (org.elasticsearch.cluster.node.DiscoveryNode)2 NamedWriteableAwareStreamInput (org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput)2 StreamInput (org.elasticsearch.common.io.stream.StreamInput)2 TransportAddress (org.elasticsearch.common.transport.TransportAddress)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 Closeable (java.io.Closeable)1 Path (java.nio.file.Path)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1