How to get count of specific value in elasticsearch java clinet

I am using elasticsearch-java 8.12, and I want to get the count of specific value,
in my example I have log index, and there is a field called result, I want to get the number of documents that the result field is "correct", how to do that?
I made a search but the document does not contains an explanation for it

Something like this should work:

try {
    client.indices().delete(dir -> dir.index("search-data"));
} catch (ElasticsearchException ignored) { }
client.index(ir -> ir.index("search-data").id("1").withJson(new StringReader("{\"result\":\"correct\"}")));
client.indices().refresh(rr -> rr.index("search-data"));
SearchResponse<Void> response = -> sr
                .query(q -> q.match(mq -> mq.field("result").query("correct"))),
        Void.class);" = {}", response.hits().total().value());