Search in sources :

Example 1 with ClearScrollResponse

use of co.elastic.clients.elasticsearch.core.ClearScrollResponse in project elasticsearch-java by elastic.

the class RequestTest method testErrorStatusCodeWithValidResponse.

@Test
public void testErrorStatusCodeWithValidResponse() throws IOException {
    // https://github.com/elastic/elasticsearch-java/issues/36
    // Some endpoints return a faulty status code 404 with a valid response.
    // Transports should first try to decode an error, and if they fail because of missing properties for
    // the error type, then try to decode the regular request.
    final ClearScrollResponse clearResponse = client.clearScroll(b -> b.scrollId("DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ=="));
    assertEquals(0, clearResponse.numFreed());
    final ClosePointInTimeResponse closeResponse = client.closePointInTime(b -> b.id("46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBY" + "QADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA=="));
    assertEquals(0, closeResponse.numFreed());
}
Also used : ClosePointInTimeResponse(co.elastic.clients.elasticsearch.core.ClosePointInTimeResponse) ClearScrollResponse(co.elastic.clients.elasticsearch.core.ClearScrollResponse) Test(org.junit.Test)

Aggregations

ClearScrollResponse (co.elastic.clients.elasticsearch.core.ClearScrollResponse)1 ClosePointInTimeResponse (co.elastic.clients.elasticsearch.core.ClosePointInTimeResponse)1 Test (org.junit.Test)1