Open
Description
This occured when trying to retrieve nodes info via the new java client (version 8.2.0)
NodesInfoResponse nodesInfoResponse = client.nodes().info();
Repro test case using testcontainers
private static GenericContainer container;
private static RestClient restClient;
private static ElasticsearchClient client;
@BeforeAll
public static void startContainer() {
container = new ElasticsearchContainer("docker.elastic.co/elasticsearch/elasticsearch:8.2.0"){
@Override
protected void containerIsStarted(InspectContainerResponse containerInfo) {
}
};
container.addEnv("discovery.type", "single-node");
// container.addEnv("path.repo", "/tmp/");
container.withEnv("xpack.security.enabled", "false");
container.withEnv("ES_JAVA_OPTS", "-Xms4g -Xmx4g");
container.addExposedPorts(9200);
container.setWaitStrategy(new LogMessageWaitStrategy().withRegEx(".*(\"message\":\\s?\"started\".*|] started\n$)"));
container.start();
container.followOutput(new Slf4jLogConsumer(LoggerFactory.getLogger(LangDetectProcessorIntegrationTests.class)));
// Create the low-level client
restClient = RestClient.builder(new HttpHost("localhost", container.getMappedPort(9200))).build();
ElasticsearchTransport transport = new RestClientTransport(restClient, new JacksonJsonpMapper());
client = new ElasticsearchClient(transport);
}
@AfterAll
public static void stopContainer() throws IOException {
if (restClient != null) {
restClient.close();
}
if (container != null) {
container.close();
}
}
@Test
public void testLangDetectPlugin() throws Exception {
// here comes the exception
NodesInfoResponse nodesInfoResponse = client.nodes().info();
}
Exception
co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch.nodes.info.NodeInfoSettings: co.elastic.clients.util.MissingRequiredPropertyException: Missing required property 'NodeInfoPath.repo' (JSON path: nodes['MWtGcjMvSk-VO_a76Vaglw'].settings.path) (line no=1, column no=923, offset=-1)
If you set path.repo
(i.e. uncomment in the above code snippet). Then another exception occurs
co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch.nodes.info.NodeInfoSettings: co.elastic.clients.util.MissingRequiredPropertyException: Missing required property 'NodeInfoDiscover.seedHosts' (JSON path: nodes.L289RMUaRFmdPARutNe2oA.settings.discovery) (line no=1, column no=974, offset=-1)
This setting is not set as discovery type is set to single node...