send refresh in alias test

This commit is contained in:
Jörg Prante 2021-01-29 11:58:06 +01:00
parent 51cf0c2d91
commit ac367270c1
3 changed files with 8 additions and 2 deletions

View file

@ -113,7 +113,6 @@ public abstract class AbstractBulkClient extends AbstractBasicClient implements
createIndexRequestBuilder.addMapping(TYPE_NAME, builder);
logger.debug("adding mapping = {}", builder.string());
} else {
// empty mapping
createIndexRequestBuilder.addMapping(TYPE_NAME,
JsonXContent.contentBuilder().startObject().startObject(TYPE_NAME).endObject().endObject());
logger.debug("empty mapping");
@ -124,6 +123,7 @@ public abstract class AbstractBulkClient extends AbstractBasicClient implements
} else {
logger.warn("index creation of {} not acknowledged", index);
}
refreshIndex(index);
}
@Override

View file

@ -3,6 +3,8 @@ package org.xbib.elx.common.test;
import com.carrotsearch.hppc.cursors.ObjectCursor;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthAction;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesAction;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesAction;
@ -10,6 +12,8 @@ import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse;
import org.elasticsearch.action.admin.indices.create.CreateIndexAction;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.action.admin.indices.refresh.RefreshAction;
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.cluster.metadata.AliasAction;
import org.elasticsearch.common.Strings;
@ -42,6 +46,7 @@ class AliasTest {
ElasticsearchClient client = helper.client("1");
CreateIndexRequest indexRequest = new CreateIndexRequest("test_index");
client.execute(CreateIndexAction.INSTANCE, indexRequest).actionGet();
client.execute(RefreshAction.INSTANCE, new RefreshRequest()).actionGet();
IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest();
String[] indices = new String[]{"test_index"};
String[] aliases = new String[]{"test_alias"};
@ -57,6 +62,7 @@ class AliasTest {
long t1 = (System.nanoTime() - t0) / 1000000;
logger.info("{} time(ms) = {}", getAliasesResponse.getAliases(), t1);
assertTrue(t1 >= 0);
client.execute(ClusterHealthAction.INSTANCE, new ClusterHealthRequest());
}
@Test

View file

@ -1,6 +1,6 @@
group = org.xbib
name = elx
version = 2.2.1.24
version = 2.2.1.25
gradle.wrapper.version = 6.6.1
xbib-metrics.version = 2.1.0