# Elastic Search REST api version dependency

**URL:** <https://discuss.elastic.co/t/elastic-search-rest-api-version-dependency/243134>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [July 29, 2020, 11:23pm UTC](https://discuss.elastic.co/t/elastic-search-rest-api-version-dependency/243134 "2020-07-29T23:23:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Musfiqur\_Siddique](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/musfiqur_siddique/32/73048_2.png) [@Musfiqur\_Siddique](https://discuss.elastic.co/u/Musfiqur_Siddique)\
**Post date:** [July 29, 2020, 11:23pm UTC](https://discuss.elastic.co/t/elastic-search-rest-api-version-dependency/243134/1 "2020-07-29T23:23:26Z")

</div>

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.

```auto
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?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 30, 2020, 2:42am UTC](https://discuss.elastic.co/t/elastic-search-rest-api-version-dependency/243134/2 "2020-07-30T02:42:26Z")

</div>

I did something like that for a personal project. See

> **[dadoonet/fscrawler](https://github.com/dadoonet/fscrawler/tree/master/elasticsearch-client/elasticsearch-client-base/src/main/java/fr/pilato/elasticsearch/crawler/fs/client)**
>
> Elasticsearch File System Crawler (FS Crawler). Contribute to dadoonet/fscrawler development by creating an account on GitHub.

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 27, 2020, 2:42am UTC](https://discuss.elastic.co/t/elastic-search-rest-api-version-dependency/243134/3 "2020-08-27T02:42:29Z")

</div>

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