More AbstractIntegrationTest

This commit is contained in:
Andrew Raines 2013-09-21 00:10:16 -05:00
parent 6a18d05393
commit 953bbe4291
17 changed files with 170 additions and 179 deletions

View File

@ -61,11 +61,10 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
@Test
public void testAliases() throws Exception {
// delete all indices
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
logger.info("--> creating index [test]");
client().admin().indices().create(createIndexRequest("test")).actionGet();
createIndex("test");
ensureGreen();
//
@ -79,19 +78,19 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
// TODO this is bogus and should have a dedicated test
logger.info("--> aliasing index [test] with [alias1]");
client().admin().indices().prepareAliases().addAlias("test", "alias1").execute().actionGet();
admin().indices().prepareAliases().addAlias("test", "alias1").execute().actionGet();
logger.info("--> indexing against [alias1], should work now");
IndexResponse indexResponse = client().index(indexRequest("alias1").type("type1").id("1").source(source("1", "test"))).actionGet();
assertThat(indexResponse.getIndex(), equalTo("test"));
logger.info("--> creating index [test]");
client().admin().indices().create(createIndexRequest("test_x")).actionGet();
admin().indices().create(createIndexRequest("test_x")).actionGet();
ensureGreen();
logger.info("--> remove [alias1], Aliasing index [test_x] with [alias1]");
client().admin().indices().aliases(indexAliasesRequest().removeAlias("test", "alias1").addAlias("test_x", "alias1")).actionGet();
admin().indices().aliases(indexAliasesRequest().removeAlias("test", "alias1").addAlias("test_x", "alias1")).actionGet();
Thread.sleep(300);
logger.info("--> indexing against [alias1], should work against [test_x]");
@ -101,17 +100,16 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
@Test
public void testFailedFilter() throws Exception {
// delete all indices
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
logger.info("--> creating index [test]");
client().admin().indices().create(createIndexRequest("test")).actionGet();
createIndex("test");
ensureGreen();
try {
logger.info("--> aliasing index [test] with [alias1] and filter [t]");
client().admin().indices().prepareAliases().addAlias("test", "alias1", "{ t }").execute().actionGet();
admin().indices().prepareAliases().addAlias("test", "alias1", "{ t }").execute().actionGet();
assert false;
} catch (Exception e) {
// all is well
@ -120,21 +118,20 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
@Test
public void testFilteringAliases() throws Exception {
// delete all indices
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
logger.info("--> creating index [test]");
client().admin().indices().create(createIndexRequest("test")).actionGet();
createIndex("test");
ensureGreen();
logger.info("--> aliasing index [test] with [alias1] and filter [user:kimchy]");
FilterBuilder filter = termFilter("user", "kimchy");
client().admin().indices().prepareAliases().addAlias("test", "alias1", filter).execute().actionGet();
admin().indices().prepareAliases().addAlias("test", "alias1", filter).execute().actionGet();
// For now just making sure that filter was stored with the alias
logger.info("--> making sure that filter was stored with alias [alias1] and filter [user:kimchy]");
ClusterState clusterState = client().admin().cluster().prepareState().execute().actionGet().getState();
ClusterState clusterState = admin().cluster().prepareState().execute().actionGet().getState();
IndexMetaData indexMd = clusterState.metaData().index("test");
assertThat(indexMd.aliases().get("alias1").filter().string(), equalTo("{\"term\":{\"user\":\"kimchy\"}}"));
@ -147,27 +144,26 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
ensureGreen();
logger.info("--> aliasing index [test] with [alias1] and empty filter");
IndicesAliasesResponse indicesAliasesResponse = client().admin().indices().prepareAliases().addAlias("test", "alias1", "{}").get();
IndicesAliasesResponse indicesAliasesResponse = admin().indices().prepareAliases().addAlias("test", "alias1", "{}").get();
//just checking that the empty doesn't lead to issues
assertThat(indicesAliasesResponse.isAcknowledged(), equalTo(true));
}
@Test
public void testSearchingFilteringAliasesSingleIndex() throws Exception {
// delete all indices
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
logger.info("--> creating index [test]");
client().admin().indices().create(createIndexRequest("test")).actionGet();
createIndex("test");
ensureGreen();
logger.info("--> adding filtering aliases to index [test]");
client().admin().indices().prepareAliases().addAlias("test", "alias1").execute().actionGet();
client().admin().indices().prepareAliases().addAlias("test", "alias2").execute().actionGet();
client().admin().indices().prepareAliases().addAlias("test", "foos", termFilter("name", "foo")).execute().actionGet();
client().admin().indices().prepareAliases().addAlias("test", "bars", termFilter("name", "bar")).execute().actionGet();
client().admin().indices().prepareAliases().addAlias("test", "tests", termFilter("name", "test")).execute().actionGet();
admin().indices().prepareAliases().addAlias("test", "alias1").execute().actionGet();
admin().indices().prepareAliases().addAlias("test", "alias2").execute().actionGet();
admin().indices().prepareAliases().addAlias("test", "foos", termFilter("name", "foo")).execute().actionGet();
admin().indices().prepareAliases().addAlias("test", "bars", termFilter("name", "bar")).execute().actionGet();
admin().indices().prepareAliases().addAlias("test", "tests", termFilter("name", "test")).execute().actionGet();
logger.info("--> indexing against [test]");
client().index(indexRequest("test").type("type1").id("1").source(source("1", "foo test")).refresh(true)).actionGet();
@ -230,27 +226,26 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
@Test
public void testSearchingFilteringAliasesTwoIndices() throws Exception {
// delete all indices
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
logger.info("--> creating index [test1]");
client().admin().indices().create(createIndexRequest("test1")).actionGet();
admin().indices().create(createIndexRequest("test1")).actionGet();
logger.info("--> creating index [test2]");
client().admin().indices().create(createIndexRequest("test2")).actionGet();
admin().indices().create(createIndexRequest("test2")).actionGet();
ensureGreen();
logger.info("--> adding filtering aliases to index [test1]");
client().admin().indices().prepareAliases().addAlias("test1", "aliasToTest1").execute().actionGet();
client().admin().indices().prepareAliases().addAlias("test1", "aliasToTests").execute().actionGet();
client().admin().indices().prepareAliases().addAlias("test1", "foos", termFilter("name", "foo")).execute().actionGet();
client().admin().indices().prepareAliases().addAlias("test1", "bars", termFilter("name", "bar")).execute().actionGet();
admin().indices().prepareAliases().addAlias("test1", "aliasToTest1").execute().actionGet();
admin().indices().prepareAliases().addAlias("test1", "aliasToTests").execute().actionGet();
admin().indices().prepareAliases().addAlias("test1", "foos", termFilter("name", "foo")).execute().actionGet();
admin().indices().prepareAliases().addAlias("test1", "bars", termFilter("name", "bar")).execute().actionGet();
logger.info("--> adding filtering aliases to index [test2]");
client().admin().indices().prepareAliases().addAlias("test2", "aliasToTest2").execute().actionGet();
client().admin().indices().prepareAliases().addAlias("test2", "aliasToTests").execute().actionGet();
client().admin().indices().prepareAliases().addAlias("test2", "foos", termFilter("name", "foo")).execute().actionGet();
admin().indices().prepareAliases().addAlias("test2", "aliasToTest2").execute().actionGet();
admin().indices().prepareAliases().addAlias("test2", "aliasToTests").execute().actionGet();
admin().indices().prepareAliases().addAlias("test2", "foos", termFilter("name", "foo")).execute().actionGet();
logger.info("--> indexing against [test1]");
client().index(indexRequest("test1").type("type1").id("1").source(source("1", "foo test")).refresh(true)).actionGet();
@ -297,28 +292,27 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
@Test
public void testSearchingFilteringAliasesMultipleIndices() throws Exception {
// delete all indices
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
logger.info("--> creating indices");
client().admin().indices().create(createIndexRequest("test1")).actionGet();
client().admin().indices().create(createIndexRequest("test2")).actionGet();
client().admin().indices().create(createIndexRequest("test3")).actionGet();
admin().indices().create(createIndexRequest("test1")).actionGet();
admin().indices().create(createIndexRequest("test2")).actionGet();
admin().indices().create(createIndexRequest("test3")).actionGet();
ensureGreen();
logger.info("--> adding aliases to indices");
client().admin().indices().prepareAliases().addAlias("test1", "alias12").execute().actionGet();
client().admin().indices().prepareAliases().addAlias("test2", "alias12").execute().actionGet();
admin().indices().prepareAliases().addAlias("test1", "alias12").execute().actionGet();
admin().indices().prepareAliases().addAlias("test2", "alias12").execute().actionGet();
logger.info("--> adding filtering aliases to indices");
client().admin().indices().prepareAliases().addAlias("test1", "filter1", termFilter("name", "test1")).execute().actionGet();
admin().indices().prepareAliases().addAlias("test1", "filter1", termFilter("name", "test1")).execute().actionGet();
client().admin().indices().prepareAliases().addAlias("test2", "filter23", termFilter("name", "foo")).execute().actionGet();
client().admin().indices().prepareAliases().addAlias("test3", "filter23", termFilter("name", "foo")).execute().actionGet();
admin().indices().prepareAliases().addAlias("test2", "filter23", termFilter("name", "foo")).execute().actionGet();
admin().indices().prepareAliases().addAlias("test3", "filter23", termFilter("name", "foo")).execute().actionGet();
client().admin().indices().prepareAliases().addAlias("test1", "filter13", termFilter("name", "baz")).execute().actionGet();
client().admin().indices().prepareAliases().addAlias("test3", "filter13", termFilter("name", "baz")).execute().actionGet();
admin().indices().prepareAliases().addAlias("test1", "filter13", termFilter("name", "baz")).execute().actionGet();
admin().indices().prepareAliases().addAlias("test3", "filter13", termFilter("name", "baz")).execute().actionGet();
logger.info("--> indexing against [test1]");
client().index(indexRequest("test1").type("type1").id("11").source(source("11", "foo test1")).refresh(true)).actionGet();
@ -362,29 +356,28 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
@Test
public void testDeletingByQueryFilteringAliases() throws Exception {
// delete all indices
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
logger.info("--> creating index [test1]");
client().admin().indices().create(createIndexRequest("test1")).actionGet();
admin().indices().create(createIndexRequest("test1")).actionGet();
logger.info("--> creating index [test2]");
client().admin().indices().create(createIndexRequest("test2")).actionGet();
admin().indices().create(createIndexRequest("test2")).actionGet();
ensureGreen();
logger.info("--> adding filtering aliases to index [test1]");
client().admin().indices().prepareAliases().addAlias("test1", "aliasToTest1").execute().actionGet();
client().admin().indices().prepareAliases().addAlias("test1", "aliasToTests").execute().actionGet();
client().admin().indices().prepareAliases().addAlias("test1", "foos", termFilter("name", "foo")).execute().actionGet();
client().admin().indices().prepareAliases().addAlias("test1", "bars", termFilter("name", "bar")).execute().actionGet();
client().admin().indices().prepareAliases().addAlias("test1", "tests", termFilter("name", "test")).execute().actionGet();
admin().indices().prepareAliases().addAlias("test1", "aliasToTest1").execute().actionGet();
admin().indices().prepareAliases().addAlias("test1", "aliasToTests").execute().actionGet();
admin().indices().prepareAliases().addAlias("test1", "foos", termFilter("name", "foo")).execute().actionGet();
admin().indices().prepareAliases().addAlias("test1", "bars", termFilter("name", "bar")).execute().actionGet();
admin().indices().prepareAliases().addAlias("test1", "tests", termFilter("name", "test")).execute().actionGet();
logger.info("--> adding filtering aliases to index [test2]");
client().admin().indices().prepareAliases().addAlias("test2", "aliasToTest2").execute().actionGet();
client().admin().indices().prepareAliases().addAlias("test2", "aliasToTests").execute().actionGet();
client().admin().indices().prepareAliases().addAlias("test2", "foos", termFilter("name", "foo")).execute().actionGet();
client().admin().indices().prepareAliases().addAlias("test2", "tests", termFilter("name", "test")).execute().actionGet();
admin().indices().prepareAliases().addAlias("test2", "aliasToTest2").execute().actionGet();
admin().indices().prepareAliases().addAlias("test2", "aliasToTests").execute().actionGet();
admin().indices().prepareAliases().addAlias("test2", "foos", termFilter("name", "foo")).execute().actionGet();
admin().indices().prepareAliases().addAlias("test2", "tests", termFilter("name", "test")).execute().actionGet();
logger.info("--> indexing against [test1]");
client().index(indexRequest("test1").type("type1").id("1").source(source("1", "foo test")).refresh(true)).actionGet();
@ -403,14 +396,14 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
logger.info("--> delete by query from a single alias");
client().prepareDeleteByQuery("bars").setQuery(QueryBuilders.termQuery("name", "test")).execute().actionGet();
client().admin().indices().prepareRefresh().execute().actionGet();
admin().indices().prepareRefresh().execute().actionGet();
logger.info("--> verify that only one record was deleted");
assertThat(client().prepareCount("test1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getCount(), equalTo(3L));
logger.info("--> delete by query from an aliases pointing to two indices");
client().prepareDeleteByQuery("foos").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet();
client().admin().indices().prepareRefresh().execute().actionGet();
admin().indices().prepareRefresh().execute().actionGet();
logger.info("--> verify that proper records were deleted");
SearchResponse searchResponse = client().prepareSearch("aliasToTests").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet();
@ -418,7 +411,7 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
logger.info("--> delete by query from an aliases and an index");
client().prepareDeleteByQuery("tests", "test2").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet();
client().admin().indices().prepareRefresh().execute().actionGet();
admin().indices().prepareRefresh().execute().actionGet();
logger.info("--> verify that proper records were deleted");
searchResponse = client().prepareSearch("aliasToTests").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet();
@ -427,16 +420,15 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
@Test
public void testWaitForAliasCreationMultipleShards() throws Exception {
// delete all indices
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
logger.info("--> creating index [test]");
client().admin().indices().create(createIndexRequest("test")).actionGet();
createIndex("test");
ensureGreen();
for (int i = 0; i < 10; i++) {
assertThat(client().admin().indices().prepareAliases().addAlias("test", "alias" + i).execute().actionGet().isAcknowledged(), equalTo(true));
assertThat(admin().indices().prepareAliases().addAlias("test", "alias" + i).execute().actionGet().isAcknowledged(), equalTo(true));
client().index(indexRequest("alias" + i).type("type1").id("1").source(source("1", "test")).refresh(true)).actionGet();
}
@ -444,16 +436,15 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
@Test
public void testWaitForAliasCreationSingleShard() throws Exception {
// delete all indices
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
logger.info("--> creating index [test]");
client().admin().indices().create(createIndexRequest("test").settings(settingsBuilder().put("index.numberOfReplicas", 0).put("index.numberOfShards", 1))).actionGet();
admin().indices().create(createIndexRequest("test").settings(settingsBuilder().put("index.numberOfReplicas", 0).put("index.numberOfShards", 1))).actionGet();
ensureGreen();
for (int i = 0; i < 10; i++) {
assertThat(client().admin().indices().prepareAliases().addAlias("test", "alias" + i).execute().actionGet().isAcknowledged(), equalTo(true));
assertThat(admin().indices().prepareAliases().addAlias("test", "alias" + i).execute().actionGet().isAcknowledged(), equalTo(true));
client().index(indexRequest("alias" + i).type("type1").id("1").source(source("1", "test")).refresh(true)).actionGet();
}
}
@ -461,11 +452,11 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
@Test
public void testWaitForAliasSimultaneousUpdate() throws Exception {
final int aliasCount = 10;
// delete all indices
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
logger.info("--> creating index [test]");
client().admin().indices().create(createIndexRequest("test")).actionGet();
createIndex("test");
ensureGreen();
@ -475,7 +466,7 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
executor.submit(new Runnable() {
@Override
public void run() {
assertThat(client().admin().indices().prepareAliases().addAlias("test", aliasName).execute().actionGet().isAcknowledged(), equalTo(true));
assertThat(admin().indices().prepareAliases().addAlias("test", aliasName).execute().actionGet().isAcknowledged(), equalTo(true));
client().index(indexRequest(aliasName).type("type1").id("1").source(source("1", "test")).refresh(true)).actionGet();
}
});
@ -491,35 +482,35 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
@Test
public void testSameAlias() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
logger.info("--> creating index [test]");
client().admin().indices().create(createIndexRequest("test")).actionGet();
createIndex("test");
ensureGreen();
logger.info("--> creating alias1 ");
assertThat(client().admin().indices().prepareAliases().addAlias("test", "alias1").execute().actionGet().isAcknowledged(), equalTo(true));
assertThat(admin().indices().prepareAliases().addAlias("test", "alias1").execute().actionGet().isAcknowledged(), equalTo(true));
TimeValue timeout = TimeValue.timeValueSeconds(2);
logger.info("--> recreating alias1 ");
StopWatch stopWatch = new StopWatch();
stopWatch.start();
assertThat(client().admin().indices().prepareAliases().addAlias("test", "alias1").setTimeout(timeout).execute().actionGet().isAcknowledged(), equalTo(true));
assertThat(admin().indices().prepareAliases().addAlias("test", "alias1").setTimeout(timeout).execute().actionGet().isAcknowledged(), equalTo(true));
assertThat(stopWatch.stop().lastTaskTime().millis(), lessThan(timeout.millis()));
logger.info("--> modifying alias1 to have a filter");
stopWatch.start();
assertThat(client().admin().indices().prepareAliases().addAlias("test", "alias1", termFilter("name", "foo")).setTimeout(timeout).execute().actionGet().isAcknowledged(), equalTo(true));
assertThat(admin().indices().prepareAliases().addAlias("test", "alias1", termFilter("name", "foo")).setTimeout(timeout).execute().actionGet().isAcknowledged(), equalTo(true));
assertThat(stopWatch.stop().lastTaskTime().millis(), lessThan(timeout.millis()));
logger.info("--> recreating alias1 with the same filter");
stopWatch.start();
assertThat(client().admin().indices().prepareAliases().addAlias("test", "alias1", termFilter("name", "foo")).setTimeout(timeout).execute().actionGet().isAcknowledged(), equalTo(true));
assertThat(admin().indices().prepareAliases().addAlias("test", "alias1", termFilter("name", "foo")).setTimeout(timeout).execute().actionGet().isAcknowledged(), equalTo(true));
assertThat(stopWatch.stop().lastTaskTime().millis(), lessThan(timeout.millis()));
logger.info("--> recreating alias1 with a different filter");
stopWatch.start();
assertThat(client().admin().indices().prepareAliases().addAlias("test", "alias1", termFilter("name", "bar")).setTimeout(timeout).execute().actionGet().isAcknowledged(), equalTo(true));
assertThat(admin().indices().prepareAliases().addAlias("test", "alias1", termFilter("name", "bar")).setTimeout(timeout).execute().actionGet().isAcknowledged(), equalTo(true));
assertThat(stopWatch.stop().lastTaskTime().millis(), lessThan(timeout.millis()));
logger.info("--> verify that filter was updated");
@ -528,12 +519,12 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
logger.info("--> deleting alias1");
stopWatch.start();
assertThat(client().admin().indices().prepareAliases().removeAlias("test", "alias1").setTimeout(timeout).execute().actionGet().isAcknowledged(), equalTo(true));
assertThat(admin().indices().prepareAliases().removeAlias("test", "alias1").setTimeout(timeout).execute().actionGet().isAcknowledged(), equalTo(true));
assertThat(stopWatch.stop().lastTaskTime().millis(), lessThan(timeout.millis()));
logger.info("--> deleting alias1 one more time");
stopWatch.start();
assertThat(client().admin().indices().prepareAliases().removeAlias("test", "alias1").setTimeout(timeout).execute().actionGet().isAcknowledged(), equalTo(true));
assertThat(admin().indices().prepareAliases().removeAlias("test", "alias1").setTimeout(timeout).execute().actionGet().isAcknowledged(), equalTo(true));
assertThat(stopWatch.stop().lastTaskTime().millis(), lessThan(timeout.millis()));
}
@ -544,36 +535,36 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
.put("index.number_of_replicas", 0)
.build();
logger.info("--> creating indices [foobar, test, test123, foobarbaz, bazbar]");
client().admin().indices().prepareCreate("foobar")
admin().indices().prepareCreate("foobar")
.setSettings(indexSettings)
.execute().actionGet();
client().admin().indices().prepareCreate("test")
admin().indices().prepareCreate("test")
.setSettings(indexSettings)
.execute().actionGet();
client().admin().indices().prepareCreate("test123")
admin().indices().prepareCreate("test123")
.setSettings(indexSettings)
.execute().actionGet();
client().admin().indices().prepareCreate("foobarbaz")
admin().indices().prepareCreate("foobarbaz")
.setSettings(indexSettings)
.execute().actionGet();
client().admin().indices().prepareCreate("bazbar")
admin().indices().prepareCreate("bazbar")
.setSettings(indexSettings)
.execute().actionGet();
ensureGreen();
logger.info("--> creating aliases [alias1, alias2]");
client().admin().indices().prepareAliases()
admin().indices().prepareAliases()
.addAlias("foobar", "alias1")
.execute().actionGet();
IndicesAliasesResponse indicesAliasesResponse = client().admin().indices().prepareAliases()
IndicesAliasesResponse indicesAliasesResponse = admin().indices().prepareAliases()
.addAlias("foobar", "alias2")
.execute().actionGet();
assertThat(indicesAliasesResponse.isAcknowledged(), equalTo(true));
logger.info("--> getting alias1");
GetAliasesResponse getResponse = client().admin().indices().prepareGetAliases("alias1").execute().actionGet();
GetAliasesResponse getResponse = admin().indices().prepareGetAliases("alias1").execute().actionGet();
assertThat(getResponse, notNullValue());
assertThat(getResponse.getAliases().size(), equalTo(1));
assertThat(getResponse.getAliases().get("foobar").size(), equalTo(1));
@ -582,11 +573,11 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
assertThat(getResponse.getAliases().get("foobar").get(0).getFilter(), nullValue());
assertThat(getResponse.getAliases().get("foobar").get(0).getIndexRouting(), nullValue());
assertThat(getResponse.getAliases().get("foobar").get(0).getSearchRouting(), nullValue());
AliasesExistResponse existsResponse = client().admin().indices().prepareAliasesExist("alias1").execute().actionGet();
AliasesExistResponse existsResponse = admin().indices().prepareAliasesExist("alias1").execute().actionGet();
assertThat(existsResponse.exists(), equalTo(true));
logger.info("--> getting all aliases that start with alias*");
getResponse = client().admin().indices().prepareGetAliases("alias*").execute().actionGet();
getResponse = admin().indices().prepareGetAliases("alias*").execute().actionGet();
assertThat(getResponse, notNullValue());
assertThat(getResponse.getAliases().size(), equalTo(1));
assertThat(getResponse.getAliases().get("foobar").size(), equalTo(2));
@ -600,24 +591,24 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
assertThat(getResponse.getAliases().get("foobar").get(1).getFilter(), nullValue());
assertThat(getResponse.getAliases().get("foobar").get(1).getIndexRouting(), nullValue());
assertThat(getResponse.getAliases().get("foobar").get(1).getSearchRouting(), nullValue());
existsResponse = client().admin().indices().prepareAliasesExist("alias*").execute().actionGet();
existsResponse = admin().indices().prepareAliasesExist("alias*").execute().actionGet();
assertThat(existsResponse.exists(), equalTo(true));
logger.info("--> creating aliases [bar, baz, foo]");
client().admin().indices().prepareAliases()
admin().indices().prepareAliases()
.addAlias("bazbar", "bar")
.addAlias("bazbar", "bac", termFilter("field", "value"))
.addAlias("foobar", "foo")
.execute().actionGet();
indicesAliasesResponse = client().admin().indices().prepareAliases()
indicesAliasesResponse = admin().indices().prepareAliases()
.addAliasAction(new AliasAction(AliasAction.Type.ADD, "foobar", "bac").routing("bla"))
.execute().actionGet();
assertThat(indicesAliasesResponse.isAcknowledged(), equalTo(true));
logger.info("--> getting bar and baz for index bazbar");
getResponse = client().admin().indices().prepareGetAliases("bar", "bac").addIndices("bazbar").execute().actionGet();
getResponse = admin().indices().prepareGetAliases("bar", "bac").addIndices("bazbar").execute().actionGet();
assertThat(getResponse, notNullValue());
assertThat(getResponse.getAliases().size(), equalTo(1));
assertThat(getResponse.getAliases().get("bazbar").size(), equalTo(2));
@ -633,12 +624,12 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
assertThat(getResponse.getAliases().get("bazbar").get(1).getFilter(), nullValue());
assertThat(getResponse.getAliases().get("bazbar").get(1).getIndexRouting(), nullValue());
assertThat(getResponse.getAliases().get("bazbar").get(1).getSearchRouting(), nullValue());
existsResponse = client().admin().indices().prepareAliasesExist("bar", "bac")
existsResponse = admin().indices().prepareAliasesExist("bar", "bac")
.addIndices("bazbar").execute().actionGet();
assertThat(existsResponse.exists(), equalTo(true));
logger.info("--> getting *b* for index baz*");
getResponse = client().admin().indices().prepareGetAliases("*b*").addIndices("baz*").execute().actionGet();
getResponse = admin().indices().prepareGetAliases("*b*").addIndices("baz*").execute().actionGet();
assertThat(getResponse, notNullValue());
assertThat(getResponse.getAliases().size(), equalTo(1));
assertThat(getResponse.getAliases().get("bazbar").size(), equalTo(2));
@ -654,12 +645,12 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
assertThat(getResponse.getAliases().get("bazbar").get(1).getFilter(), nullValue());
assertThat(getResponse.getAliases().get("bazbar").get(1).getIndexRouting(), nullValue());
assertThat(getResponse.getAliases().get("bazbar").get(1).getSearchRouting(), nullValue());
existsResponse = client().admin().indices().prepareAliasesExist("*b*")
existsResponse = admin().indices().prepareAliasesExist("*b*")
.addIndices("baz*").execute().actionGet();
assertThat(existsResponse.exists(), equalTo(true));
logger.info("--> getting *b* for index *bar");
getResponse = client().admin().indices().prepareGetAliases("b*").addIndices("*bar").execute().actionGet();
getResponse = admin().indices().prepareGetAliases("b*").addIndices("*bar").execute().actionGet();
assertThat(getResponse, notNullValue());
assertThat(getResponse.getAliases().size(), equalTo(2));
assertThat(getResponse.getAliases().get("bazbar").size(), equalTo(2));
@ -680,12 +671,12 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
assertThat(getResponse.getAliases().get("foobar").get(0).getFilter(), nullValue());
assertThat(getResponse.getAliases().get("foobar").get(0).getIndexRouting(), equalTo("bla"));
assertThat(getResponse.getAliases().get("foobar").get(0).getSearchRouting(), equalTo("bla"));
existsResponse = client().admin().indices().prepareAliasesExist("b*")
existsResponse = admin().indices().prepareAliasesExist("b*")
.addIndices("*bar").execute().actionGet();
assertThat(existsResponse.exists(), equalTo(true));
logger.info("--> getting f* for index *bar");
getResponse = client().admin().indices().prepareGetAliases("f*").addIndices("*bar").execute().actionGet();
getResponse = admin().indices().prepareGetAliases("f*").addIndices("*bar").execute().actionGet();
assertThat(getResponse, notNullValue());
assertThat(getResponse.getAliases().size(), equalTo(1));
assertThat(getResponse.getAliases().get("foobar").get(0), notNullValue());
@ -693,13 +684,13 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
assertThat(getResponse.getAliases().get("foobar").get(0).getFilter(), nullValue());
assertThat(getResponse.getAliases().get("foobar").get(0).getIndexRouting(), nullValue());
assertThat(getResponse.getAliases().get("foobar").get(0).getSearchRouting(), nullValue());
existsResponse = client().admin().indices().prepareAliasesExist("f*")
existsResponse = admin().indices().prepareAliasesExist("f*")
.addIndices("*bar").execute().actionGet();
assertThat(existsResponse.exists(), equalTo(true));
// alias at work
logger.info("--> getting f* for index *bac");
getResponse = client().admin().indices().prepareGetAliases("foo").addIndices("*bac").execute().actionGet();
getResponse = admin().indices().prepareGetAliases("foo").addIndices("*bac").execute().actionGet();
assertThat(getResponse, notNullValue());
assertThat(getResponse.getAliases().size(), equalTo(1));
assertThat(getResponse.getAliases().get("foobar").size(), equalTo(1));
@ -708,12 +699,12 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
assertThat(getResponse.getAliases().get("foobar").get(0).getFilter(), nullValue());
assertThat(getResponse.getAliases().get("foobar").get(0).getIndexRouting(), nullValue());
assertThat(getResponse.getAliases().get("foobar").get(0).getSearchRouting(), nullValue());
existsResponse = client().admin().indices().prepareAliasesExist("foo")
existsResponse = admin().indices().prepareAliasesExist("foo")
.addIndices("*bac").execute().actionGet();
assertThat(existsResponse.exists(), equalTo(true));
logger.info("--> getting foo for index foobar");
getResponse = client().admin().indices().prepareGetAliases("foo").addIndices("foobar").execute().actionGet();
getResponse = admin().indices().prepareGetAliases("foo").addIndices("foobar").execute().actionGet();
assertThat(getResponse, notNullValue());
assertThat(getResponse.getAliases().size(), equalTo(1));
assertThat(getResponse.getAliases().get("foobar").get(0), notNullValue());
@ -721,29 +712,29 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
assertThat(getResponse.getAliases().get("foobar").get(0).getFilter(), nullValue());
assertThat(getResponse.getAliases().get("foobar").get(0).getIndexRouting(), nullValue());
assertThat(getResponse.getAliases().get("foobar").get(0).getSearchRouting(), nullValue());
existsResponse = client().admin().indices().prepareAliasesExist("foo")
existsResponse = admin().indices().prepareAliasesExist("foo")
.addIndices("foobar").execute().actionGet();
assertThat(existsResponse.exists(), equalTo(true));
// alias at work again
logger.info("--> getting * for index *bac");
getResponse = client().admin().indices().prepareGetAliases("*").addIndices("*bac").execute().actionGet();
getResponse = admin().indices().prepareGetAliases("*").addIndices("*bac").execute().actionGet();
assertThat(getResponse, notNullValue());
assertThat(getResponse.getAliases().size(), equalTo(2));
assertThat(getResponse.getAliases().get("foobar").size(), equalTo(4));
assertThat(getResponse.getAliases().get("bazbar").size(), equalTo(2));
existsResponse = client().admin().indices().prepareAliasesExist("*")
existsResponse = admin().indices().prepareAliasesExist("*")
.addIndices("*bac").execute().actionGet();
assertThat(existsResponse.exists(), equalTo(true));
indicesAliasesResponse = client().admin().indices().prepareAliases()
indicesAliasesResponse = admin().indices().prepareAliases()
.removeAlias("foobar", "foo")
.execute().actionGet();
assertThat(indicesAliasesResponse.isAcknowledged(), equalTo(true));
getResponse = client().admin().indices().prepareGetAliases("foo").addIndices("foobar").execute().actionGet();
getResponse = admin().indices().prepareGetAliases("foo").addIndices("foobar").execute().actionGet();
assertThat(getResponse.getAliases().isEmpty(), equalTo(true));
existsResponse = client().admin().indices().prepareAliasesExist("foo")
existsResponse = admin().indices().prepareAliasesExist("foo")
.addIndices("foobar").execute().actionGet();
assertThat(existsResponse.exists(), equalTo(false));
}
@ -751,35 +742,35 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
@Test(expected = ActionRequestValidationException.class)
public void testAddAliasNullIndex() {
client().admin().indices().prepareAliases().addAliasAction(AliasAction.newAddAliasAction(null, "alias1"))
admin().indices().prepareAliases().addAliasAction(AliasAction.newAddAliasAction(null, "alias1"))
.execute().actionGet();
}
@Test(expected = ActionRequestValidationException.class)
public void testAddAliasEmptyIndex() {
client().admin().indices().prepareAliases().addAliasAction(AliasAction.newAddAliasAction("", "alias1"))
admin().indices().prepareAliases().addAliasAction(AliasAction.newAddAliasAction("", "alias1"))
.execute().actionGet();
}
@Test(expected = ActionRequestValidationException.class)
public void testAddAliasNullAlias() {
client().admin().indices().prepareAliases().addAliasAction(AliasAction.newAddAliasAction("index1", null))
admin().indices().prepareAliases().addAliasAction(AliasAction.newAddAliasAction("index1", null))
.execute().actionGet();
}
@Test(expected = ActionRequestValidationException.class)
public void testAddAliasEmptyAlias() {
client().admin().indices().prepareAliases().addAliasAction(AliasAction.newAddAliasAction("index1", ""))
admin().indices().prepareAliases().addAliasAction(AliasAction.newAddAliasAction("index1", ""))
.execute().actionGet();
}
@Test
public void testAddAliasNullAliasNullIndex() {
try {
client().admin().indices().prepareAliases().addAliasAction(AliasAction.newAddAliasAction(null, null))
admin().indices().prepareAliases().addAliasAction(AliasAction.newAddAliasAction(null, null))
.execute().actionGet();
assertTrue("Should throw " + ActionRequestValidationException.class.getSimpleName(), false);
} catch (ActionRequestValidationException e) {
@ -791,7 +782,7 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
@Test
public void testAddAliasEmptyAliasEmptyIndex() {
try {
client().admin().indices().prepareAliases().addAliasAction(AliasAction.newAddAliasAction("", ""))
admin().indices().prepareAliases().addAliasAction(AliasAction.newAddAliasAction("", ""))
.execute().actionGet();
assertTrue("Should throw " + ActionRequestValidationException.class.getSimpleName(), false);
} catch (ActionRequestValidationException e) {
@ -802,32 +793,32 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
@Test(expected = ActionRequestValidationException.class)
public void tesRemoveAliasNullIndex() {
client().admin().indices().prepareAliases().addAliasAction(AliasAction.newRemoveAliasAction(null, "alias1"))
admin().indices().prepareAliases().addAliasAction(AliasAction.newRemoveAliasAction(null, "alias1"))
.execute().actionGet();
}
@Test(expected = ActionRequestValidationException.class)
public void tesRemoveAliasEmptyIndex() {
client().admin().indices().prepareAliases().addAliasAction(AliasAction.newRemoveAliasAction("", "alias1"))
admin().indices().prepareAliases().addAliasAction(AliasAction.newRemoveAliasAction("", "alias1"))
.execute().actionGet();
}
@Test(expected = ActionRequestValidationException.class)
public void tesRemoveAliasNullAlias() {
client().admin().indices().prepareAliases().addAliasAction(AliasAction.newRemoveAliasAction("index1", null))
admin().indices().prepareAliases().addAliasAction(AliasAction.newRemoveAliasAction("index1", null))
.execute().actionGet();
}
@Test(expected = ActionRequestValidationException.class)
public void tesRemoveAliasEmptyAlias() {
client().admin().indices().prepareAliases().addAliasAction(AliasAction.newRemoveAliasAction("index1", ""))
admin().indices().prepareAliases().addAliasAction(AliasAction.newRemoveAliasAction("index1", ""))
.execute().actionGet();
}
@Test
public void testRemoveAliasNullAliasNullIndex() {
try {
client().admin().indices().prepareAliases().addAliasAction(AliasAction.newAddAliasAction(null, null))
admin().indices().prepareAliases().addAliasAction(AliasAction.newAddAliasAction(null, null))
.execute().actionGet();
assertTrue("Should throw " + ActionRequestValidationException.class.getSimpleName(), false);
} catch (ActionRequestValidationException e) {
@ -839,7 +830,7 @@ public class IndexAliasesTests extends AbstractIntegrationTest {
@Test
public void testRemoveAliasEmptyAliasEmptyIndex() {
try {
client().admin().indices().prepareAliases().addAliasAction(AliasAction.newAddAliasAction("", ""))
admin().indices().prepareAliases().addAliasAction(AliasAction.newAddAliasAction("", ""))
.execute().actionGet();
assertTrue("Should throw " + ActionRequestValidationException.class.getSimpleName(), false);
} catch (ActionRequestValidationException e) {

View File

@ -805,7 +805,7 @@ public class SimpleQueryTests extends AbstractIntegrationTest {
@Test
public void testBasicFilterById() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").execute().actionGet();
ensureGreen();
@ -839,7 +839,7 @@ public class SimpleQueryTests extends AbstractIntegrationTest {
@Test
public void testBasicQueryById() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").execute().actionGet();
ensureGreen();
@ -877,7 +877,7 @@ public class SimpleQueryTests extends AbstractIntegrationTest {
@Test
public void testNumericTermsAndRanges() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder().put("index.number_of_shards", 1))
.addMapping("type1", jsonBuilder().startObject().startObject("type1").startObject("properties")
.startObject("num_byte").field("type", "byte").endObject()
@ -983,7 +983,7 @@ public class SimpleQueryTests extends AbstractIntegrationTest {
@Test
public void testNumericRangeFilter_2826() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").setSettings(
ImmutableSettings.settingsBuilder()
.put("index.number_of_shards", 1)

View File

@ -37,7 +37,7 @@ public class DeleteByQueryTests extends AbstractIntegrationTest {
@Test
public void testDeleteAllNoIndices() {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareRefresh().execute().actionGet();
DeleteByQueryRequestBuilder deleteByQueryRequestBuilder = client().prepareDeleteByQuery();
deleteByQueryRequestBuilder.setQuery(QueryBuilders.matchAllQuery());
@ -47,7 +47,7 @@ public class DeleteByQueryTests extends AbstractIntegrationTest {
@Test
public void testDeleteAllOneIndex() {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
String json = "{" + "\"user\":\"kimchy\"," + "\"postDate\":\"2013-01-30\"," + "\"message\":\"trying out Elastic Search\"" + "}";
@ -70,7 +70,7 @@ public class DeleteByQueryTests extends AbstractIntegrationTest {
@Test
public void testMissing() {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
String json = "{" + "\"user\":\"kimchy\"," + "\"postDate\":\"2013-01-30\"," + "\"message\":\"trying out Elastic Search\"" + "}";
@ -101,7 +101,7 @@ public class DeleteByQueryTests extends AbstractIntegrationTest {
@Test
public void testFailure() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("twitter").execute().actionGet();
DeleteByQueryResponse response = client().prepareDeleteByQuery("twitter")

View File

@ -158,7 +158,7 @@ public class BulkTests extends AbstractIntegrationTest {
@Test
public void testBulkUpdate_malformedScripts() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test")
.setSettings(

View File

@ -204,7 +204,7 @@ public class GetActionTests extends AbstractIntegrationTest {
@Test
public void realtimeGetWithCompress() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1))
.addMapping("type", jsonBuilder().startObject().startObject("type").startObject("_source").field("compress", true).endObject().endObject().endObject())
@ -227,7 +227,7 @@ public class GetActionTests extends AbstractIntegrationTest {
@Test
public void getFieldsWithDifferentTypes() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1))
.addMapping("type1", jsonBuilder().startObject().startObject("type").startObject("_source").field("enabled", true).endObject().endObject().endObject())
@ -399,7 +399,7 @@ public class GetActionTests extends AbstractIntegrationTest {
@Test
public void testThatGetFromTranslogShouldWorkWithExclude() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
String index = "test";
String type = "type1";
@ -435,7 +435,7 @@ public class GetActionTests extends AbstractIntegrationTest {
@Test
public void testThatGetFromTranslogShouldWorkWithInclude() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
String index = "test";
String type = "type1";
@ -472,7 +472,7 @@ public class GetActionTests extends AbstractIntegrationTest {
@SuppressWarnings("unchecked")
@Test
public void testThatGetFromTranslogShouldWorkWithIncludeExcludeAndFields() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
String index = "test";
String type = "type1";

View File

@ -34,7 +34,7 @@ public class IgnoreIndicesTests extends AbstractIntegrationTest {
@Test
public void testMissing() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test1").execute().actionGet();
ensureYellow();
@ -149,7 +149,7 @@ public class IgnoreIndicesTests extends AbstractIntegrationTest {
@Test
public void testAllMissing() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test1").execute().actionGet();
ensureYellow();
try {

View File

@ -88,7 +88,7 @@ public class AnalyzeActionTests extends AbstractIntegrationTest {
@Test
public void analyzeWithNoIndex() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
AnalyzeResponse analyzeResponse = client().admin().indices().prepareAnalyze("THIS IS A TEST").setAnalyzer("simple").execute().actionGet();
assertThat(analyzeResponse.getTokens().size(), equalTo(4));
@ -100,7 +100,7 @@ public class AnalyzeActionTests extends AbstractIntegrationTest {
@Test
public void analyzerWithFieldOrTypeTests() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").execute().actionGet();
client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet();

View File

@ -49,7 +49,7 @@ public class CacheTests extends AbstractIntegrationTest {
@Test
public void testClearCacheFilterKeys() {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder().put("index.number_of_shards", 1)).execute().actionGet();
client().prepareIndex("test", "type", "1").setSource("field", "value").execute().actionGet();
client().admin().indices().prepareRefresh().execute().actionGet();
@ -75,7 +75,7 @@ public class CacheTests extends AbstractIntegrationTest {
@Test
public void testFieldDataStats() {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder().put("index.number_of_shards", 1)).execute().actionGet();
client().prepareIndex("test", "type", "1").setSource("field", "value1", "field2", "value1").execute().actionGet();
client().prepareIndex("test", "type", "2").setSource("field", "value2", "field2", "value2").execute().actionGet();
@ -120,7 +120,7 @@ public class CacheTests extends AbstractIntegrationTest {
@Test
public void testClearAllCaches() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test")
.setSettings(ImmutableSettings.settingsBuilder()
.put("index.number_of_replicas", 0)

View File

@ -150,7 +150,7 @@ public class SimpleIndexStatsTests extends AbstractIntegrationTest {
@Test
public void testMergeStats() {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
// rely on 1 replica for this tests
client().admin().indices().prepareCreate("test1").execute().actionGet();
@ -190,7 +190,7 @@ public class SimpleIndexStatsTests extends AbstractIntegrationTest {
@Test
public void testAllFlags() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
// rely on 1 replica for this tests
client().admin().indices().prepareCreate("test1").execute().actionGet();
client().admin().indices().prepareCreate("test2").execute().actionGet();

View File

@ -253,7 +253,7 @@ public class SimpleNestedTests extends AbstractIntegrationTest {
}
private void noChildrenNestedDeleteByQuery(long total, int docToDelete) throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test")
.setSettings(settingsBuilder().put("index.number_of_shards", 1).put("index.referesh_interval", -1).build())
@ -374,7 +374,7 @@ public class SimpleNestedTests extends AbstractIntegrationTest {
}
private void testFacets(int numberOfShards) throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test")
.setSettings(settingsBuilder().put("index.number_of_shards", numberOfShards))
@ -497,7 +497,7 @@ public class SimpleNestedTests extends AbstractIntegrationTest {
// When IncludeNestedDocsQuery is wrapped in a FilteredQuery then a in-finite loop occurs b/c of a bug in IncludeNestedDocsQuery#advance()
// This IncludeNestedDocsQuery also needs to be aware of the filter from alias
public void testDeleteNestedDocsWithAlias() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test")
.setSettings(settingsBuilder().put("index.number_of_shards", 1).put("index.referesh_interval", -1).build())
@ -561,7 +561,7 @@ public class SimpleNestedTests extends AbstractIntegrationTest {
@Test
public void testExplain() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test")
.addMapping("type1", jsonBuilder().startObject().startObject("type1").startObject("properties")
@ -606,7 +606,7 @@ public class SimpleNestedTests extends AbstractIntegrationTest {
@Test
public void testSimpleNestedSorting() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test")
.setSettings(settingsBuilder()
.put("index.number_of_shards", 1)
@ -781,7 +781,7 @@ public class SimpleNestedTests extends AbstractIntegrationTest {
@Test
public void testSimpleNestedSorting_withNestedFilterMissing() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test")
.setSettings(settingsBuilder()
.put("index.number_of_shards", 1)
@ -871,7 +871,7 @@ public class SimpleNestedTests extends AbstractIntegrationTest {
@Test
public void testSortNestedWithNestedFilter() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test")
.setSettings(ImmutableSettings.settingsBuilder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0))
.addMapping("type1", XContentFactory.jsonBuilder().startObject()

View File

@ -265,7 +265,7 @@ public class SimpleRoutingTests extends AbstractIntegrationTest {
@Test
public void testRequiredRoutingWithPathNumericType() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test")
.addMapping("type1", XContentFactory.jsonBuilder().startObject().startObject("type1")

View File

@ -52,7 +52,7 @@ public class CustomScoreSearchTests extends AbstractIntegrationTest {
@Test
public void testScoreExplainBug_2283() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").setSettings(settingsBuilder().put("index.number_of_shards", 1)).execute()
.actionGet();
ClusterHealthResponse healthResponse = client().admin().cluster().prepareHealth("test").setWaitForYellowStatus().execute()
@ -127,7 +127,7 @@ public class CustomScoreSearchTests extends AbstractIntegrationTest {
@Test
public void testScoreExplainBug_2283_withFunctionScore() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").setSettings(settingsBuilder().put("index.number_of_shards", 1)).execute()
.actionGet();
ClusterHealthResponse healthResponse = client().admin().cluster().prepareHealth("test").setWaitForYellowStatus().execute()
@ -200,7 +200,7 @@ public class CustomScoreSearchTests extends AbstractIntegrationTest {
@Test
public void testMultiValueCustomScriptBoost() throws ElasticSearchException, IOException {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin()
.indices()
@ -305,7 +305,7 @@ public class CustomScoreSearchTests extends AbstractIntegrationTest {
@Test
public void testMultiValueCustomScriptBoost_withFunctionScore() throws ElasticSearchException, IOException {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin()
.indices()
@ -420,7 +420,7 @@ public class CustomScoreSearchTests extends AbstractIntegrationTest {
@Test
public void testCustomScriptBoost() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").setSettings(settingsBuilder().put("index.number_of_shards", 1)).execute()
.actionGet();
@ -529,7 +529,7 @@ public class CustomScoreSearchTests extends AbstractIntegrationTest {
@Test
public void testCustomScriptBoost_withFunctionScore() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").setSettings(settingsBuilder().put("index.number_of_shards", 1)).execute()
.actionGet();
@ -638,7 +638,7 @@ public class CustomScoreSearchTests extends AbstractIntegrationTest {
@Test
public void testTriggerBooleanScorer() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").setSettings(settingsBuilder().put("index.number_of_shards", 1)).execute()
.actionGet();
@ -657,7 +657,7 @@ public class CustomScoreSearchTests extends AbstractIntegrationTest {
@Test
public void testTriggerBooleanScorer_withFunctionScore() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").setSettings(settingsBuilder().put("index.number_of_shards", 1)).execute()
.actionGet();
@ -678,7 +678,7 @@ public class CustomScoreSearchTests extends AbstractIntegrationTest {
@Test
public void testCustomFiltersScore() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").setSettings(settingsBuilder().put("index.number_of_shards", 1)).execute()
.actionGet();
@ -860,7 +860,7 @@ public class CustomScoreSearchTests extends AbstractIntegrationTest {
@Test
public void testCustomFiltersScore_withFunctionScore() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").setSettings(settingsBuilder().put("index.number_of_shards", 1)).execute()
.actionGet();

View File

@ -430,7 +430,7 @@ public class GeoDistanceTests extends AbstractIntegrationTest {
@Test
public void testDistanceSortingNestedFields() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
String mapping = XContentFactory.jsonBuilder().startObject().startObject("company")
.startObject("properties")
.startObject("name").field("type", "string").endObject()

View File

@ -1101,7 +1101,7 @@ public class SimpleQueryTests extends AbstractIntegrationTest {
@Test
public void testBasicFilterById() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").execute().actionGet();
ensureGreen();
@ -1154,7 +1154,7 @@ public class SimpleQueryTests extends AbstractIntegrationTest {
@Test
public void testBasicQueryById() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").execute().actionGet();
ensureGreen();
@ -1199,7 +1199,7 @@ public class SimpleQueryTests extends AbstractIntegrationTest {
@Test
public void testNumericTermsAndRanges() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder().put("index.number_of_shards", 1))
.addMapping("type1", jsonBuilder().startObject().startObject("type1").startObject("properties")
.startObject("num_byte").field("type", "byte").endObject()
@ -1329,7 +1329,7 @@ public class SimpleQueryTests extends AbstractIntegrationTest {
@Test
public void testNumericRangeFilter_2826() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").setSettings(
ImmutableSettings.settingsBuilder()
.put("index.number_of_shards", 1)
@ -1407,7 +1407,7 @@ public class SimpleQueryTests extends AbstractIntegrationTest {
@Test // see #2926
public void testMustNot() throws ElasticSearchException, IOException {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").setSettings(
ImmutableSettings.settingsBuilder()
.put("index.number_of_shards", 2)

View File

@ -33,7 +33,7 @@ public class SimpleTimestampTests extends AbstractIntegrationTest {
@Test
public void testSimpleTimestamp() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test")
.addMapping("type1", XContentFactory.jsonBuilder().startObject().startObject("type1").startObject("_timestamp").field("enabled", true).field("store", "yes").endObject().endObject().endObject())

View File

@ -50,7 +50,7 @@ public class SimpleTTLTests extends AbstractIntegrationTest {
@Test
public void testSimpleTTL() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test")
.addMapping("type1", XContentFactory.jsonBuilder()

View File

@ -50,7 +50,7 @@ public class SimpleValidateQueryTests extends AbstractIntegrationTest {
@Test
public void simpleValidateQuery() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder().put("index.number_of_shards", 1)).execute().actionGet();
client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet();
@ -77,7 +77,7 @@ public class SimpleValidateQueryTests extends AbstractIntegrationTest {
@Test
public void explainValidateQuery() throws Exception {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder().put("index.number_of_shards", 1)).execute().actionGet();
client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet();
@ -189,7 +189,7 @@ public class SimpleValidateQueryTests extends AbstractIntegrationTest {
@Test
public void explainValidateQueryTwoNodes() throws IOException {
client().admin().indices().prepareDelete().execute().actionGet();
wipeIndices();
client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder()
.put("index.number_of_shards", 1)