Best practice for TDocument class reference to pass to Java's ElasticsearchClient methods?

Hi,
I am using the latest Java REST API client and wondering what Class<TDocument> reference I should be passing to the search() method in case of no object domain model is being used.

At present I am using a bare Map.class and things are working as expected, though @SuppressWarnings("rawtypes") is needed: see for example https://github.com/apache/syncope/blob/master/ext/elasticsearch/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/ElasticsearchAnySearchDAO.java#L314-L320

Is such approach correct? TIA
Regards.

If you don't need to get the documents, you can pass Void.

Otherwise ObjectNode. See Reading documents by id | Elasticsearch Java API Client [8.10] | Elastic

Thank you very much @dadoonet it seems I did miss the part about ObjectNode from the docs.
The Void option is indeed very interesting, I'd suggest to include it in the docs as well.

Regards.