@Override
    public Optional<SearchVersion> version() {

        final Request request = new Request("GET", "/?filter_path=version.number,version.distribution");
        final Optional<JsonNode> resp = Optional.of(jsonApi.perform(request, "Unable to retrieve cluster information"));

        final Optional<String> version = resp.map(r -> r.path("version")).map(r -> r.path("number")).map(JsonNode::textValue);

        final SearchVersion.Distribution distribution = resp.map(r -> r.path("version")).map(r -> r.path("distribution")).map(JsonNode::textValue)
                .map(StringUtils::toUpperCase)
                .map(SearchVersion.Distribution::valueOf)
                .orElse(SearchVersion.Distribution.ELASTICSEARCH);

        return version
                .map(this::parseVersion)
                .map(v -> SearchVersion.create(distribution, v));
    }
@Test
    void testElasticsearchVersionFetching() throws IOException {
        mockResponse("{\"version\" : " +
                " {" +
                "    \"number\" : \"7.10.2\"" +
                " }" +
                "}");

        assertThat(toTest.version())
                .isNotEmpty()
                .contains(SearchVersion.create(SearchVersion.Distribution.ELASTICSEARCH, Version.parse("7.10.2")));

    }