fix mapping / date detection, adapt to API changes
This commit is contained in:
parent
c03e47cf26
commit
fb0dfbb683
11 changed files with 38 additions and 37 deletions
|
@ -68,7 +68,7 @@ class ClientTest {
|
|||
} catch (NoNodeAvailableException e) {
|
||||
logger.warn("skipping, no node available");
|
||||
} finally {
|
||||
assertEquals(1, client.getBulkMetric().getSucceeded().getCount());
|
||||
assertEquals(1, client.getBulkController().getBulkMetric().getSucceeded().getCount());
|
||||
if (client.getBulkController().getLastBulkError() != null) {
|
||||
logger.error("error", client.getBulkController().getLastBulkError());
|
||||
}
|
||||
|
@ -116,6 +116,7 @@ class ClientTest {
|
|||
Settings settings = Settings.builder().put("index.number_of_shards", "1").build();
|
||||
XContentBuilder builder = JsonXContent.contentBuilder()
|
||||
.startObject()
|
||||
.field("date_detection", false)
|
||||
.startObject("properties")
|
||||
.startObject("pos")
|
||||
.field("type", "geo_point")
|
||||
|
@ -157,7 +158,7 @@ class ClientTest {
|
|||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
} finally {
|
||||
assertEquals(numactions, client.getBulkMetric().getSucceeded().getCount());
|
||||
assertEquals(numactions, client.getBulkController().getBulkMetric().getSucceeded().getCount());
|
||||
if (client.getBulkController().getLastBulkError() != null) {
|
||||
logger.error("error", client.getBulkController().getLastBulkError());
|
||||
}
|
||||
|
@ -214,7 +215,7 @@ class ClientTest {
|
|||
logger.warn("latch timeout");
|
||||
}
|
||||
client.stopBulk("test", 30L, TimeUnit.SECONDS);
|
||||
assertEquals(maxthreads * actions, client.getBulkMetric().getSucceeded().getCount());
|
||||
assertEquals(maxthreads * actions, client.getBulkController().getBulkMetric().getSucceeded().getCount());
|
||||
} catch (NoNodeAvailableException e) {
|
||||
logger.warn("skipping, no node available");
|
||||
} catch (Exception e) {
|
||||
|
@ -224,7 +225,7 @@ class ClientTest {
|
|||
logger.error("error", client.getBulkController().getLastBulkError());
|
||||
}
|
||||
assertNull(client.getBulkController().getLastBulkError());
|
||||
assertEquals(maxthreads * actions, client.getBulkMetric().getSucceeded().getCount());
|
||||
assertEquals(maxthreads * actions, client.getBulkController().getBulkMetric().getSucceeded().getCount());
|
||||
logger.log(Level.INFO, "refreshing index test");
|
||||
client.refreshIndex("test");
|
||||
SearchSourceBuilder builder = new SearchSourceBuilder()
|
||||
|
|
|
@ -69,7 +69,7 @@ class DuplicateIDTest {
|
|||
logger.warn("skipping, no node available");
|
||||
} finally {
|
||||
client.close();
|
||||
assertEquals(numactions, client.getBulkMetric().getSucceeded().getCount());
|
||||
assertEquals(numactions, client.getBulkController().getBulkMetric().getSucceeded().getCount());
|
||||
if (client.getBulkController().getLastBulkError() != null) {
|
||||
logger.error("error", client.getBulkController().getLastBulkError());
|
||||
}
|
||||
|
|
|
@ -60,8 +60,8 @@ class SmokeTest {
|
|||
int replica = client.getReplicaLevel(indexDefinition);
|
||||
assertEquals(2, replica);
|
||||
client.deleteIndex(indexDefinition);
|
||||
assertEquals(0, client.getBulkMetric().getFailed().getCount());
|
||||
assertEquals(6, client.getBulkMetric().getSucceeded().getCount());
|
||||
assertEquals(0, client.getBulkController().getBulkMetric().getFailed().getCount());
|
||||
assertEquals(6, client.getBulkController().getBulkMetric().getSucceeded().getCount());
|
||||
} catch (NoNodeAvailableException e) {
|
||||
logger.warn("skipping, no node available");
|
||||
} finally {
|
||||
|
|
|
@ -66,7 +66,7 @@ class ClientTest {
|
|||
} catch (NoNodeAvailableException e) {
|
||||
logger.warn("skipping, no node available");
|
||||
} finally {
|
||||
assertEquals(1, client.getBulkMetric().getSucceeded().getCount());
|
||||
assertEquals(1, client.getBulkController().getBulkMetric().getSucceeded().getCount());
|
||||
if (client.getBulkController().getLastBulkError() != null) {
|
||||
logger.error("error", client.getBulkController().getLastBulkError());
|
||||
}
|
||||
|
@ -111,6 +111,7 @@ class ClientTest {
|
|||
Settings settings = Settings.builder().put("index.number_of_shards", "1").build();
|
||||
XContentBuilder builder = JsonXContent.contentBuilder()
|
||||
.startObject()
|
||||
.field("date_detection", false)
|
||||
.startObject("properties")
|
||||
.startObject("location")
|
||||
.field("type", "geo_point")
|
||||
|
@ -152,7 +153,7 @@ class ClientTest {
|
|||
} catch (NoNodeAvailableException e) {
|
||||
logger.warn("skipping, no node available");
|
||||
} finally {
|
||||
assertEquals(numactions, client.getBulkMetric().getSucceeded().getCount());
|
||||
assertEquals(numactions, client.getBulkController().getBulkMetric().getSucceeded().getCount());
|
||||
if (client.getBulkController().getLastBulkError() != null) {
|
||||
logger.error("error", client.getBulkController().getLastBulkError());
|
||||
}
|
||||
|
@ -209,7 +210,7 @@ class ClientTest {
|
|||
logger.warn("latch timeout");
|
||||
}
|
||||
client.stopBulk("test", 30L, TimeUnit.SECONDS);
|
||||
assertEquals(maxthreads * actions, client.getBulkMetric().getSucceeded().getCount());
|
||||
assertEquals(maxthreads * actions, client.getBulkController().getBulkMetric().getSucceeded().getCount());
|
||||
} catch (NoNodeAvailableException e) {
|
||||
logger.warn("skipping, no node available");
|
||||
} finally {
|
||||
|
@ -217,7 +218,7 @@ class ClientTest {
|
|||
logger.error("error", client.getBulkController().getLastBulkError());
|
||||
}
|
||||
assertNull(client.getBulkController().getLastBulkError());
|
||||
assertEquals(maxthreads * actions, client.getBulkMetric().getSucceeded().getCount());
|
||||
assertEquals(maxthreads * actions, client.getBulkController().getBulkMetric().getSucceeded().getCount());
|
||||
logger.log(Level.INFO, "refreshing index test");
|
||||
client.refreshIndex("test");
|
||||
SearchSourceBuilder builder = new SearchSourceBuilder()
|
||||
|
|
|
@ -68,7 +68,7 @@ class DuplicateIDTest {
|
|||
logger.warn("skipping, no node available");
|
||||
} finally {
|
||||
client.close();
|
||||
assertEquals(numactions, client.getBulkMetric().getSucceeded().getCount());
|
||||
assertEquals(numactions, client.getBulkController().getBulkMetric().getSucceeded().getCount());
|
||||
if (client.getBulkController().getLastBulkError() != null) {
|
||||
logger.error("error", client.getBulkController().getLastBulkError());
|
||||
}
|
||||
|
|
|
@ -59,8 +59,8 @@ class SmokeTest {
|
|||
int replica = client.getReplicaLevel(indexDefinition);
|
||||
assertEquals(2, replica);
|
||||
client.deleteIndex(indexDefinition);
|
||||
//assertEquals(0, client.getBulkMetric().getFailed().getCount());
|
||||
//assertEquals(6, client.getBulkMetric().getSucceeded().getCount());
|
||||
assertEquals(0, client.getBulkController().getBulkMetric().getFailed().getCount());
|
||||
assertEquals(6, client.getBulkController().getBulkMetric().getSucceeded().getCount());
|
||||
} catch (NoNodeAvailableException e) {
|
||||
logger.warn("skipping, no node available");
|
||||
} finally {
|
||||
|
|
|
@ -124,13 +124,15 @@ public class ExtendedTransportClient extends AbstractExtendedClient {
|
|||
logger.info("connected to nodes = {}", nodes);
|
||||
if (nodes != null && !nodes.isEmpty()) {
|
||||
if (autodiscover) {
|
||||
logger.debug("trying to auto-discover all nodes...");
|
||||
logger.debug("trying to discover all nodes...");
|
||||
ClusterStateRequestBuilder clusterStateRequestBuilder =
|
||||
new ClusterStateRequestBuilder(getClient(), ClusterStateAction.INSTANCE);
|
||||
ClusterStateResponse clusterStateResponse = clusterStateRequestBuilder.execute().actionGet();
|
||||
DiscoveryNodes discoveryNodes = clusterStateResponse.getState().getNodes();
|
||||
addDiscoveryNodes(transportClient, discoveryNodes);
|
||||
logger.info("after auto-discovery: connected to {}", transportClient.connectedNodes());
|
||||
for (DiscoveryNode discoveryNode : discoveryNodes) {
|
||||
transportClient.addTransportAddress(discoveryNode.getAddress());
|
||||
}
|
||||
logger.info("after discovery: connected to {}", transportClient.connectedNodes());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -142,9 +144,9 @@ public class ExtendedTransportClient extends AbstractExtendedClient {
|
|||
// "cluster.name"
|
||||
.put(ClusterName.CLUSTER_NAME_SETTING.getKey(),
|
||||
settings.get(ClusterName.CLUSTER_NAME_SETTING.getKey()))
|
||||
// "processors"
|
||||
.put(EsExecutors.PROCESSORS_SETTING.getKey(),
|
||||
settings.get(EsExecutors.PROCESSORS_SETTING.getKey(),
|
||||
// "node.processors"
|
||||
.put(EsExecutors.NODE_PROCESSORS_SETTING.getKey(),
|
||||
settings.get(EsExecutors.NODE_PROCESSORS_SETTING.getKey(),
|
||||
String.valueOf(Runtime.getRuntime().availableProcessors())))
|
||||
// "transport.type"
|
||||
.put(NetworkModule.TRANSPORT_TYPE_KEY,
|
||||
|
@ -152,12 +154,6 @@ public class ExtendedTransportClient extends AbstractExtendedClient {
|
|||
.build();
|
||||
}
|
||||
|
||||
private void addDiscoveryNodes(TransportClient transportClient, DiscoveryNodes discoveryNodes) {
|
||||
for (DiscoveryNode discoveryNode : discoveryNodes) {
|
||||
transportClient.addTransportAddress(discoveryNode.getAddress());
|
||||
}
|
||||
}
|
||||
|
||||
static class MyTransportClient extends TransportClient {
|
||||
|
||||
MyTransportClient(Settings settings, Collection<Class<? extends Plugin>> plugins) {
|
||||
|
|
|
@ -66,7 +66,7 @@ class ClientTest {
|
|||
} catch (NoNodeAvailableException e) {
|
||||
logger.warn("skipping, no node available");
|
||||
} finally {
|
||||
assertEquals(1, client.getBulkMetric().getSucceeded().getCount());
|
||||
assertEquals(1, client.getBulkController().getBulkMetric().getSucceeded().getCount());
|
||||
if (client.getBulkController().getLastBulkError() != null) {
|
||||
logger.error("error", client.getBulkController().getLastBulkError());
|
||||
}
|
||||
|
@ -114,6 +114,7 @@ class ClientTest {
|
|||
Settings settings = Settings.builder().put("index.number_of_shards", "1").build();
|
||||
XContentBuilder builder = JsonXContent.contentBuilder()
|
||||
.startObject()
|
||||
.field("date_detection", false)
|
||||
.startObject("properties")
|
||||
.startObject("location")
|
||||
.field("type", "geo_point")
|
||||
|
@ -121,9 +122,11 @@ class ClientTest {
|
|||
.endObject()
|
||||
.endObject();
|
||||
client.newIndex("test", settings, builder);
|
||||
GetMappingsRequest getMappingsRequest = new GetMappingsRequest().indices("test");
|
||||
GetMappingsResponse getMappingsResponse =
|
||||
client.getClient().execute(GetMappingsAction.INSTANCE, getMappingsRequest).actionGet();
|
||||
GetMappingsRequest getMappingsRequest = new GetMappingsRequest()
|
||||
.indices("test");
|
||||
GetMappingsResponse getMappingsResponse = client.getClient()
|
||||
.execute(GetMappingsAction.INSTANCE, getMappingsRequest)
|
||||
.actionGet();
|
||||
logger.info("mappings={}", getMappingsResponse.getMappings());
|
||||
assertTrue(getMappingsResponse.getMappings().get("test").containsKey("_doc"));
|
||||
client.close();
|
||||
|
@ -151,7 +154,7 @@ class ClientTest {
|
|||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
} finally {
|
||||
assertEquals(numactions, client.getBulkMetric().getSucceeded().getCount());
|
||||
assertEquals(numactions, client.getBulkController().getBulkMetric().getSucceeded().getCount());
|
||||
if (client.getBulkController().getLastBulkError() != null) {
|
||||
logger.error("error", client.getBulkController().getLastBulkError());
|
||||
}
|
||||
|
@ -216,7 +219,7 @@ class ClientTest {
|
|||
logger.warn("latch timeout");
|
||||
}
|
||||
client.stopBulk("test", 30L, TimeUnit.SECONDS);
|
||||
assertEquals(maxthreads * actions, client.getBulkMetric().getSucceeded().getCount());
|
||||
assertEquals(maxthreads * actions, client.getBulkController().getBulkMetric().getSucceeded().getCount());
|
||||
} catch (NoNodeAvailableException e) {
|
||||
logger.warn("skipping, no node available");
|
||||
} catch (Exception e) {
|
||||
|
@ -226,7 +229,7 @@ class ClientTest {
|
|||
logger.error("error", client.getBulkController().getLastBulkError());
|
||||
}
|
||||
assertNull(client.getBulkController().getLastBulkError());
|
||||
assertEquals(maxthreads * actions, client.getBulkMetric().getSucceeded().getCount());
|
||||
assertEquals(maxthreads * actions, client.getBulkController().getBulkMetric().getSucceeded().getCount());
|
||||
logger.log(Level.INFO, "refreshing index test");
|
||||
client.refreshIndex("test");
|
||||
SearchSourceBuilder builder = new SearchSourceBuilder()
|
||||
|
|
|
@ -69,7 +69,7 @@ class DuplicateIDTest {
|
|||
logger.warn("skipping, no node available");
|
||||
} finally {
|
||||
client.close();
|
||||
assertEquals(numactions, client.getBulkMetric().getSucceeded().getCount());
|
||||
assertEquals(numactions, client.getBulkController().getBulkMetric().getSucceeded().getCount());
|
||||
if (client.getBulkController().getLastBulkError() != null) {
|
||||
logger.error("error", client.getBulkController().getLastBulkError());
|
||||
}
|
||||
|
|
|
@ -57,8 +57,8 @@ class SmokeTest {
|
|||
int replica = client.getReplicaLevel(indexDefinition);
|
||||
assertEquals(2, replica);
|
||||
client.deleteIndex(indexDefinition);
|
||||
assertEquals(0, client.getBulkMetric().getFailed().getCount());
|
||||
assertEquals(4, client.getBulkMetric().getSucceeded().getCount());
|
||||
assertEquals(0, client.getBulkController().getBulkMetric().getFailed().getCount());
|
||||
assertEquals(4, client.getBulkController().getBulkMetric().getSucceeded().getCount());
|
||||
} catch (NoNodeAvailableException e) {
|
||||
logger.warn("skipping, no node available");
|
||||
} finally {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
group = org.xbib
|
||||
name = elx
|
||||
version = 7.6.1.0
|
||||
version = 7.6.1.1
|
||||
|
||||
elasticsearch.version = 7.6.1
|
||||
netty.version = 4.1.49.Final
|
||||
|
|
Loading…
Reference in a new issue