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

Remove HLRC from ES codebase #83423

Closed
66 tasks done
dakrone opened this issue Feb 2, 2022 · 12 comments · Fixed by #105406
Closed
66 tasks done

Remove HLRC from ES codebase #83423

dakrone opened this issue Feb 2, 2022 · 12 comments · Fixed by #105406
Labels
Team:Clients Meta label for clients team >tech debt

Comments

@dakrone
Copy link
Member

dakrone commented Feb 2, 2022

Description

With the launch of the new Java client the Elasticsearch High Level Rest Client (HLRC) is deprecated, no longer shipped as an artifact, and can be removed from the ES codebase. This meta issue is to track the the removal of the HLRC for 8.x.

Steps (subject to change):

As each sub client is removed its creator inside of RestHighLevelClient to indicate that portion of the removal is "done".

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

dakrone added a commit to dakrone/elasticsearch that referenced this issue Feb 2, 2022
We are in the process of removing the High Level Rest Client from the ES codebase. This starts by
removing all the HLRC tests themselves so that the other usages can be removed incrementally.

Relates to elastic#83423
dakrone added a commit that referenced this issue Feb 2, 2022
We are in the process of removing the High Level Rest Client from the ES codebase. This starts by
removing all the HLRC tests themselves so that the other usages can be removed incrementally.

Relates to #83423
dakrone added a commit to dakrone/elasticsearch that referenced this issue Feb 3, 2022
It was used in the SLM permissions tests to check permissions for policy and retention CRUD. This
commit replaces it with the LLRC equivalent.

Relates to elastic#83423
dakrone added a commit that referenced this issue Feb 5, 2022
It was used in the SLM permissions tests to check permissions for policy and retention CRUD. This
commit replaces it with the LLRC equivalent.

Relates to #83423
tvernum added a commit to tvernum/elasticsearch that referenced this issue Feb 7, 2022
The High Level Rest Client (HLRC) is deprecated and is no longer
shipped as a standalone artifact.
It can now be safely removed from the ES codebase.

This commit removes all security methods from the HLRC
"SecurityClient", along with their associated Request/Response
classes.

All remaining methods and classes are used by existing tests and will
need to be reviewed.

Relates: elastic#83423
gmarouli added a commit to gmarouli/elasticsearch that referenced this issue Feb 7, 2022
tvernum added a commit that referenced this issue Feb 8, 2022
The High Level Rest Client (HLRC) is deprecated and is no longer
shipped as a standalone artifact.
It can now be safely removed from the ES codebase.

This commit removes unused security methods from the HLRC
"SecurityClient", along with their associated Request/Response
classes.

All remaining methods and classes are used by existing tests and will
need to be reviewed.

Relates: #83423
tvernum added a commit to tvernum/elasticsearch that referenced this issue Feb 8, 2022
Removes the `enableUser` and `disableUser` methods from the High Level
Rest Client's `SecurityClient` and replaces existing usage in tests
with a helper method.

Relates: elastic#83423
gmarouli added a commit that referenced this issue Feb 10, 2022
tvernum added a commit that referenced this issue Feb 11, 2022
Removes the `enableUser` and `disableUser` methods from the High Level
Rest Client's `SecurityClient` and replaces existing usage in tests
with a helper method.

Relates: #83423
tvernum added a commit that referenced this issue Feb 16, 2022
Removes the following methods from the SecurityClient component
of the High Level Rest Client

- putUser
- deleteUser
- changePassword
- authenticate

As part of this change, I renamed the SecurityClientTestHelper class
to TestSecurityClient and made it a real object rather than a set of
utility methods.

This was needed because different tests need different RequestOptions
objects, but passing it into every method made it cumbersome.
The code is clearer if we use a field in the test client itself. 

Relates: #83423
tvernum added a commit to tvernum/elasticsearch that referenced this issue Feb 22, 2022
This commit removes role and role-mapping related methods from the
High Level Rest Client, and adds light weight replacements to the
TestSecurityClient

Relates: elastic#83423
@elasticsearchmachine elasticsearchmachine added Team:Clients Meta label for clients team and removed Team:Data Management Meta label for data/management team labels Nov 30, 2022
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/clients-team (Team:Clients)

@joegallo joegallo added the Team:Data Management Meta label for data/management team label Nov 30, 2022
@elasticsearchmachine elasticsearchmachine removed the Team:Data Management Meta label for data/management team label Nov 30, 2022
@joegallo
Copy link
Contributor

joegallo commented Nov 30, 2022

Only 8 public (well, public final) methods remaining on RestHighLevelClient, all of which have some actual caller somewhere. And only 12 java files left in the rest-high-level directory. 🎉

edit: And only ten classes that import the HLRC:

joegallo@galactic:~/Code/elastic/elasticsearch $ git grep 'import org.elasticsearch.client.RestHighLevelClient' | wc -l
      10

@joegallo
Copy link
Contributor

joegallo commented Dec 2, 2022

joegallo@galactic:~/Code/elastic/elasticsearch $ git ls-files | grep rest-high-level | grep analytics
client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/ParsedStringStats.java
client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/ParsedTopMetrics.java
client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/StringStatsAggregationBuilder.java
client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/TopMetricsAggregationBuilder.java
joegallo@galactic:~/Code/elastic/elasticsearch $ git grep 'import org.elasticsearch.client.analytics' | grep -v rest-high-level
x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/stringstats/InternalStringStatsTests.java:import org.elasticsearch.client.analytics.ParsedStringStats;
x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/topmetrics/InternalTopMetricsTests.java:import org.elasticsearch.client.analytics.ParsedTopMetrics;

I chatted with @nik9000 about these four classes today, and he brought up #26220. Those classes do still (or, well, may still) have value w.r.t. to testing bwc of json responses. Adding better testing of that via our normal rest tests is under the banner of #26220, so at some point I expect that we'll just be able to drop those entirely, as long as we're sure the for-testing-bwc-purposes value of them has already been captured elsewhere.

@nik9000
Copy link
Member

nik9000 commented Dec 2, 2022

I think it's worth confirming that we get good coverage of the json response in the yaml tests and then removing our usage of the classes in ES. It's a little bit of surgery, but we are capable of it.

@joegallo
Copy link
Contributor

joegallo commented Nov 2, 2023

joegallo@simulacron:~/Code/elastic/elasticsearch $ git grep 'import org.elasticsearch.client.RestHighLevelClient'
qa/ccs-unavailable-clusters/src/javaRestTest/java/org/elasticsearch/search/CrossClusterSearchUnavailableClusterIT.java:import org.elasticsearch.client.RestHighLevelClient;
qa/multi-cluster-search/src/test/java/org/elasticsearch/search/CCSDuelIT.java:import org.elasticsearch.client.RestHighLevelClient;
joegallo@simulacron:~/Code/elastic/elasticsearch $ git ls-files | grep rest-high-level | grep java
client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java
client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java
client/rest-high-level/src/main/java/org/elasticsearch/client/Validatable.java
client/rest-high-level/src/main/java/org/elasticsearch/client/ValidationException.java
client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/ParsedStringStats.java
client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/ParsedTopMetrics.java
client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/StringStatsAggregationBuilder.java
client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/TopMetricsAggregationBuilder.java
client/rest-high-level/src/main/java/org/elasticsearch/client/asyncsearch/AsyncSearchResponse.java
client/rest-high-level/src/main/java/org/elasticsearch/client/core/MainResponse.java

Only two more test classes left using RestHighLevelClient. 🎉

@iverase
Copy link
Contributor

iverase commented Nov 13, 2023

FYI: #102049

@iverase
Copy link
Contributor

iverase commented Nov 15, 2023

FYI: #102222

@joegallo
Copy link
Contributor

#102305 drops RestHighLevelClient itself (as well as some supporting classes and files), but the client/rest-high-level directory isn't empty, so we're not finished here yet:

joegallo@simulacron:~/Code/elastic/elasticsearch $ git ls-files | grep client/rest-high-level
client/rest-high-level/build.gradle
client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/ParsedStringStats.java
client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/ParsedTopMetrics.java
client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/StringStatsAggregationBuilder.java
client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/TopMetricsAggregationBuilder.java
client/rest-high-level/src/main/java/org/elasticsearch/client/asyncsearch/AsyncSearchResponse.java
client/rest-high-level/src/main/resources/forbidden/rest-high-level-signatures.txt
joegallo@simulacron:~/Code/elastic/elasticsearch $ git grep 'import org.elasticsearch.client.analytics'
x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/stringstats/InternalStringStatsTests.java:import org.elasticsearch.client.analytics.ParsedStringStats;
x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/topmetrics/InternalTopMetricsTests.java:import org.elasticsearch.client.analytics.ParsedTopMetrics;
joegallo@simulacron:~/Code/elastic/elasticsearch $ git grep 'import org.elasticsearch.client.asyncsearch'
x-pack/plugin/async-search/qa/security/src/javaRestTest/java/org/elasticsearch/xpack/search/AsyncSearchSecurityIT.java:import org.elasticsearch.client.asyncsearch.AsyncSearchResponse;

There are still five classes remaining in client/rest-high-level and they are used by three distinct tests. The AsyncSearchResponse change looks like relatively low-hanging fruit, and then there's still the conversation from #83423 (comment).

@joegallo
Copy link
Contributor

joegallo commented Feb 7, 2024

joegallo@simulacron:~/Code/elastic/elasticsearch $ git ls-files | grep rest-high-level
client/rest-high-level/build.gradle
client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/StringStatsAggregationBuilder.java
client/rest-high-level/src/main/java/org/elasticsearch/client/analytics/TopMetricsAggregationBuilder.java
client/rest-high-level/src/main/java/org/elasticsearch/client/asyncsearch/AsyncSearchResponse.java
client/rest-high-level/src/main/resources/forbidden/rest-high-level-signatures.txt
joegallo@simulacron:~/Code/elastic/elasticsearch $ git grep -E '(org.elasticsearch.client.analytics|org.elasticsearch.client.asyncsearch)' | grep -v package | sed -e "s/:.*//g" | sort | uniq
x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/stringstats/StringStatsAggregationBuilderTests.java
x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/topmetrics/TopMetricsAggregationBuilderTests.java
x-pack/plugin/async-search/qa/security/src/javaRestTest/java/org/elasticsearch/xpack/search/AsyncSearchSecurityIT.java

Not much change since November, there are three classes remaining in client/rest-high-level and three distinct tests that rely on them.

@iverase
Copy link
Contributor

iverase commented Feb 8, 2024

FYI: #105294

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Clients Meta label for clients team >tech debt
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants