Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracted builder (or json request generation) classes to libs with minimal dependencies #30791

Closed
marco-miller opened this issue May 22, 2018 · 4 comments

Comments

@marco-miller
Copy link

Using the Elasticsearch low-level Java API or rest client is convenient because of the minimal dependencies that library has. It would be as useful (if not essential) for integrations like ours to benefit from minimal dependencies as well for the Builder classes.

A similar, related extraction was completed recently for XContent: #28504. How about considering doing the same for Builder classes in packages such as index.query, action.support, search.builder and maybe more? Those classes work closely with XContentBuilder thus could benefit from a similar extraction treatment.

Of course, the sibling high-level API aims at a similar purpose, but with more dependencies which conflict with libraries that are already integrated. That approach also prevents a system embedding an Elasticsearch client from supporting multiple Elasticsearch server versions.

@dadoonet
Copy link
Member

See also #29184

@davido
Copy link

davido commented May 22, 2018

Yes, I'm aware of the transitive dependency of high level client on Lucene. That why we were considering to use low level rest client.

Still, for queries we have to use classes from ES org.elasticsearch.index.query package. But these classes are again depend on Lucene and on the rest of the server ES package, e.g. here ExistsQueryBuilder example:

https://github.com/elastic/elasticsearch/blob/master/server/src/main/java/org/elasticsearch/index/query/ExistsQueryBuilder.java#L22-L39.

And thus could not be easily isolated from the rest of the server code, unfortunately.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@colings86
Copy link
Contributor

As mentioned in #29184 (comment) this is definitely a goal of the High Level REST client (to separate its dependencies from the server dependencies. However this is a lot of work and it will take us time to achieve it as the dependencies are complex and some are used in the client code itself which we would need to unpick. Unfortunately its not as easy as moving classes to a new jar.

I'm going to close this issue in favour of #29184 since we already have discussion on this there.

lucamilanesio pushed a commit to GerritCodeReview/gerrit that referenced this issue May 28, 2018
Remove jest API which depends on Elasticsearch native API (also
removed), so no longer depend on lucene for this scope. Replace such
removed dependencies with the Elasticsearch low-level API, which does
not depend on Lucene. That now used API is a REST client with minimal
dependencies, indeed. -As opposed to Elastic's current high-level API,
which still depends on lucene and other Gerrit-constraining libraries.

Do so in order to decouple the elasticsearch client from lucene in
Gerrit. That REST client does not logically require Lucene anyway. Most
importantly, such decoupling now enables upcoming support for more than
just one Elasticsearch server version. This includes the new possibility
of bumping the latter to multiple yet later versions, such as 5 and 6.x.
The currently used version (2.4) should also still be kept, for a while.

Bumping such versions will likely require some Elasticsearch client code
adaptations, so that Gerrit can (dynamically?) switch between either
Elasticsearch server version to eventually support (hopefully soon).

Doing the same for the elasticsearch tests in Gerrit is to be done using
another change or more changes.

Add a partial and customized fork of [1], based on [1]'s commit [2], to
preserve the ability of building proper json requests for Elasticsearch.
Put that forked json-generating code under a new 'builders' sub-package.
There should be a possibility in some near future to consider removing
that fork, based on potential progress such as the one proposed in [3].
Meanwhile, this fork shall be maintained to usual Gerrit quality levels.

[1] https://github.com/elastic/elasticsearch
[2] tag: v2.4.4
[3] elastic/elasticsearch#30791

Bug: Issue 6094
Change-Id: I720c9885c9eab2388acc328eecb9eaa6940ced0c
lucamilanesio pushed a commit to GerritCodeReview/gerrit that referenced this issue Jun 4, 2018
Remove jest API which depends on Elasticsearch native API (also
removed), so no longer depend on lucene for this scope. Replace such
removed dependencies with the Elasticsearch low-level API, which does
not depend on Lucene. That now used API is a REST client with minimal
dependencies, indeed. -As opposed to Elastic's current high-level API,
which still depends on lucene and other Gerrit-constraining libraries.

Do so in order to decouple the elasticsearch client from lucene in
Gerrit. That REST client does not logically require Lucene anyway. Most
importantly, such decoupling now enables upcoming support for more than
just one Elasticsearch server version. This includes the new possibility
of bumping the latter to multiple yet later versions, such as 5 and 6.x.
The currently used version (2.4) should also still be kept, for a while.

Bumping such versions will likely require some Elasticsearch client code
adaptations, so that Gerrit can (dynamically?) switch between either
Elasticsearch server version to eventually support (hopefully soon).

Doing the same for the elasticsearch tests in Gerrit is to be done using
another change or more changes.

Add a partial and customized fork of [1], based on [1]'s commit [2], to
preserve the ability of building proper json requests for Elasticsearch.
Put that forked json-generating code under a new 'builders' sub-package.
There should be a possibility in some near future to consider removing
that fork, based on potential progress such as the one proposed in [3].
Meanwhile, this fork shall be maintained to usual Gerrit quality levels.

[1] https://github.com/elastic/elasticsearch
[2] tag: v2.4.4
[3] elastic/elasticsearch#30791

Bug: Issue 6094
Change-Id: I720c9885c9eab2388acc328eecb9eaa6940ced0c
lucamilanesio pushed a commit to lucamilanesio/index-elasticsearch that referenced this issue May 13, 2022
Remove jest API which depends on Elasticsearch native API (also
removed), so no longer depend on lucene for this scope. Replace such
removed dependencies with the Elasticsearch low-level API, which does
not depend on Lucene. That now used API is a REST client with minimal
dependencies, indeed. -As opposed to Elastic's current high-level API,
which still depends on lucene and other Gerrit-constraining libraries.

Do so in order to decouple the elasticsearch client from lucene in
Gerrit. That REST client does not logically require Lucene anyway. Most
importantly, such decoupling now enables upcoming support for more than
just one Elasticsearch server version. This includes the new possibility
of bumping the latter to multiple yet later versions, such as 5 and 6.x.
The currently used version (2.4) should also still be kept, for a while.

Bumping such versions will likely require some Elasticsearch client code
adaptations, so that Gerrit can (dynamically?) switch between either
Elasticsearch server version to eventually support (hopefully soon).

Doing the same for the elasticsearch tests in Gerrit is to be done using
another change or more changes.

Add a partial and customized fork of [1], based on [1]'s commit [2], to
preserve the ability of building proper json requests for Elasticsearch.
Put that forked json-generating code under a new 'builders' sub-package.
There should be a possibility in some near future to consider removing
that fork, based on potential progress such as the one proposed in [3].
Meanwhile, this fork shall be maintained to usual Gerrit quality levels.

[1] https://github.com/elastic/elasticsearch
[2] tag: v2.4.4
[3] elastic/elasticsearch#30791

Bug: Issue 6094
Change-Id: I720c9885c9eab2388acc328eecb9eaa6940ced0c
lucamilanesio pushed a commit to lucamilanesio/index-elasticsearch that referenced this issue May 13, 2022
Remove jest API which depends on Elasticsearch native API (also
removed), so no longer depend on lucene for this scope. Replace such
removed dependencies with the Elasticsearch low-level API, which does
not depend on Lucene. That now used API is a REST client with minimal
dependencies, indeed. -As opposed to Elastic's current high-level API,
which still depends on lucene and other Gerrit-constraining libraries.

Do so in order to decouple the elasticsearch client from lucene in
Gerrit. That REST client does not logically require Lucene anyway. Most
importantly, such decoupling now enables upcoming support for more than
just one Elasticsearch server version. This includes the new possibility
of bumping the latter to multiple yet later versions, such as 5 and 6.x.
The currently used version (2.4) should also still be kept, for a while.

Bumping such versions will likely require some Elasticsearch client code
adaptations, so that Gerrit can (dynamically?) switch between either
Elasticsearch server version to eventually support (hopefully soon).

Doing the same for the elasticsearch tests in Gerrit is to be done using
another change or more changes.

Add a partial and customized fork of [1], based on [1]'s commit [2], to
preserve the ability of building proper json requests for Elasticsearch.
Put that forked json-generating code under a new 'builders' sub-package.
There should be a possibility in some near future to consider removing
that fork, based on potential progress such as the one proposed in [3].
Meanwhile, this fork shall be maintained to usual Gerrit quality levels.

[1] https://github.com/elastic/elasticsearch
[2] tag: v2.4.4
[3] elastic/elasticsearch#30791

Bug: Issue 6094
Change-Id: I720c9885c9eab2388acc328eecb9eaa6940ced0c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants