Search in sources :

Example 1 with NodesResponse

use of co.elastic.clients.elasticsearch.cat.NodesResponse in project elasticsearch-java by elastic.

the class SerializationTest method testArrayValueBody.

@Test
public void testArrayValueBody() {
    NodesResponse nr = NodesResponse.of(_0 -> _0.valueBody(_1 -> _1.bulkTotalOperations("1")).valueBody(_1 -> _1.bulkTotalOperations("2")));
    checkJsonRoundtrip(nr, "[{\"bulk.total_operations\":\"1\"},{\"bulk.total_operations\":\"2\"}]");
    assertEquals(2, nr.valueBody().size());
    assertEquals("1", nr.valueBody().get(0).bulkTotalOperations());
    assertEquals("2", nr.valueBody().get(1).bulkTotalOperations());
}
Also used : ClassGraph(io.github.classgraph.ClassGraph) JsonParser(jakarta.json.stream.JsonParser) NodesResponse(co.elastic.clients.elasticsearch.cat.NodesResponse) JsonParsingException(jakarta.json.stream.JsonParsingException) ClassInfo(io.github.classgraph.ClassInfo) JsonValue(jakarta.json.JsonValue) JsonpDeserializable(co.elastic.clients.json.JsonpDeserializable) Test(org.junit.Test) JsonpMapperBase(co.elastic.clients.json.JsonpMapperBase) JsonpDeserializer(co.elastic.clients.json.JsonpDeserializer) ClassInfoList(io.github.classgraph.ClassInfoList) Json(jakarta.json.Json) GetSourceResponse(co.elastic.clients.elasticsearch.core.GetSourceResponse) StringReader(java.io.StringReader) JsonpUtils(co.elastic.clients.json.JsonpUtils) ScanResult(io.github.classgraph.ScanResult) NodesResponse(co.elastic.clients.elasticsearch.cat.NodesResponse) Test(org.junit.Test)

Example 2 with NodesResponse

use of co.elastic.clients.elasticsearch.cat.NodesResponse in project elasticsearch-java by elastic.

the class RequestTest method testCatRequest.

@Test
public void testCatRequest() throws IOException {
    // Cat requests should have the "format=json" added by the transport
    NodesResponse nodes = client.cat().nodes(_0 -> _0);
    System.out.println(ModelTestCase.toJson(nodes, client._transport().jsonpMapper()));
    assertEquals(1, nodes.valueBody().size());
    assertEquals("*", nodes.valueBody().get(0).master());
}
Also used : NodesResponse(co.elastic.clients.elasticsearch.cat.NodesResponse) Test(org.junit.Test)

Aggregations

NodesResponse (co.elastic.clients.elasticsearch.cat.NodesResponse)2 Test (org.junit.Test)2 GetSourceResponse (co.elastic.clients.elasticsearch.core.GetSourceResponse)1 JsonpDeserializable (co.elastic.clients.json.JsonpDeserializable)1 JsonpDeserializer (co.elastic.clients.json.JsonpDeserializer)1 JsonpMapperBase (co.elastic.clients.json.JsonpMapperBase)1 JsonpUtils (co.elastic.clients.json.JsonpUtils)1 ClassGraph (io.github.classgraph.ClassGraph)1 ClassInfo (io.github.classgraph.ClassInfo)1 ClassInfoList (io.github.classgraph.ClassInfoList)1 ScanResult (io.github.classgraph.ScanResult)1 Json (jakarta.json.Json)1 JsonValue (jakarta.json.JsonValue)1 JsonParser (jakarta.json.stream.JsonParser)1 JsonParsingException (jakarta.json.stream.JsonParsingException)1 StringReader (java.io.StringReader)1