Elastic Search REST api version dependency

I see that there is a lot of similarities among different ES Highlevel REST versions in terms the api signature and data models
https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high.html. However they require use to have different version of jar file. Is there any open source and version independent library that I can use to complete hide the version dependent model from my code?
For example, I am looking for a generic interface that I can use directly in my code without pointing to any version specific jar file.

Interface ElasticSearchHighLevelClient{
   BulkResponse bulk(BulkRequest request); 
}

class ElasticSearchHighLevelClient6 implements ElasticSearchHighLevelClient{
   BulkResponse bulk(BulkRequest request){
         return ES 6 specific output;
   } 
}

class ElasticSearchHighLevelClient7 implements ElasticSearchHighLevelClient{
   BulkResponse bulk(BulkRequest request){
         return ES 7 specific output;
   } 
}

Is that a bad idea to create such abstraction? If yes why did not ES created such a library?

I did something like that for a personal project. See

It's an interface basically where you have 2 different implementations. Not exactly what you asked for though.

I don't think there's a plan to have a very generic implementation which can support any major version of elasticsearch.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.