|
|
@@ -17,7 +17,7 @@
|
|
|
* under the License.
|
|
|
*/
|
|
|
|
|
|
-package org.elasticsearch.test.integration.search;
|
|
|
+package org.elasticsearch.test.integration.search.embedded;
|
|
|
|
|
|
import org.elasticsearch.client.Client;
|
|
|
import org.elasticsearch.client.Requests;
|
|
|
@@ -29,10 +29,10 @@ import org.elasticsearch.cluster.routing.operation.plain.PlainOperationRouting;
|
|
|
import org.elasticsearch.common.collect.ImmutableMap;
|
|
|
import org.elasticsearch.common.inject.AbstractModule;
|
|
|
import org.elasticsearch.common.inject.Inject;
|
|
|
+import org.elasticsearch.common.settings.ImmutableSettings;
|
|
|
import org.elasticsearch.common.settings.Settings;
|
|
|
import org.elasticsearch.common.trove.ExtTIntArrayList;
|
|
|
import org.elasticsearch.common.unit.TimeValue;
|
|
|
-import org.elasticsearch.indices.IndicesService;
|
|
|
import org.elasticsearch.node.internal.InternalNode;
|
|
|
import org.elasticsearch.search.*;
|
|
|
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
|
|
@@ -63,6 +63,7 @@ import java.util.concurrent.TimeUnit;
|
|
|
import static org.elasticsearch.client.Requests.*;
|
|
|
import static org.elasticsearch.common.collect.Lists.*;
|
|
|
import static org.elasticsearch.common.collect.Maps.*;
|
|
|
+import static org.elasticsearch.common.settings.ImmutableSettings.*;
|
|
|
import static org.elasticsearch.common.unit.TimeValue.*;
|
|
|
import static org.elasticsearch.index.query.xcontent.QueryBuilders.*;
|
|
|
import static org.elasticsearch.search.builder.SearchSourceBuilder.*;
|
|
|
@@ -75,8 +76,6 @@ import static org.hamcrest.Matchers.*;
|
|
|
*/
|
|
|
public class TwoInstanceUnbalancedShardsEmbeddedSearchTests extends AbstractNodesTests {
|
|
|
|
|
|
- private IndicesService indicesService;
|
|
|
-
|
|
|
private ClusterService clusterService;
|
|
|
|
|
|
private Map<String, SearchService> nodeToSearchService;
|
|
|
@@ -84,13 +83,17 @@ public class TwoInstanceUnbalancedShardsEmbeddedSearchTests extends AbstractNode
|
|
|
private SearchPhaseController searchPhaseController;
|
|
|
|
|
|
@BeforeClass public void createNodeAndInitWithData() throws Exception {
|
|
|
- startNode("server1");
|
|
|
- startNode("server2");
|
|
|
+ ImmutableSettings.Builder nodeSettings = ImmutableSettings.settingsBuilder()
|
|
|
+ .put("cluster.routing.operation.type", "org.elasticsearch.test.integration.search.embedded.TwoInstanceUnbalancedShardsEmbeddedSearchTests$UnevenOperationRoutingModule");
|
|
|
+ startNode("server1", nodeSettings);
|
|
|
+ startNode("server2", nodeSettings);
|
|
|
|
|
|
clusterService = ((InternalNode) node("server1")).injector().getInstance(ClusterService.class);
|
|
|
- indicesService = ((InternalNode) node("server1")).injector().getInstance(IndicesService.class);
|
|
|
|
|
|
- client("server1").admin().indices().create(Requests.createIndexRequest("test")).actionGet();
|
|
|
+ client("server1").admin().indices().create(Requests.createIndexRequest("test")
|
|
|
+ .settings(settingsBuilder().put("number_of_shards", 3).put("number_of_replicas", 0)))
|
|
|
+ .actionGet();
|
|
|
+ client("server1").admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
|
|
|
|
|
|
for (int i = 0; i < 100; i++) {
|
|
|
index(client("server1"), Integer.toString(i), "test", i);
|