From ac367270c1d5527a1ee8b1517f7e98d76c9869af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rg=20Prante?= Date: Fri, 29 Jan 2021 11:58:06 +0100 Subject: [PATCH] send refresh in alias test --- .../main/java/org/xbib/elx/common/AbstractBulkClient.java | 2 +- .../src/test/java/org/xbib/elx/common/test/AliasTest.java | 6 ++++++ gradle.properties | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/elx-common/src/main/java/org/xbib/elx/common/AbstractBulkClient.java b/elx-common/src/main/java/org/xbib/elx/common/AbstractBulkClient.java index 073faf3..3beeb2e 100644 --- a/elx-common/src/main/java/org/xbib/elx/common/AbstractBulkClient.java +++ b/elx-common/src/main/java/org/xbib/elx/common/AbstractBulkClient.java @@ -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 diff --git a/elx-common/src/test/java/org/xbib/elx/common/test/AliasTest.java b/elx-common/src/test/java/org/xbib/elx/common/test/AliasTest.java index 5c559bb..0e11135 100644 --- a/elx-common/src/test/java/org/xbib/elx/common/test/AliasTest.java +++ b/elx-common/src/test/java/org/xbib/elx/common/test/AliasTest.java @@ -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 diff --git a/gradle.properties b/gradle.properties index fb5a695..c4a9778 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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