Skip to content

Commit

Permalink
[Rename] ElasticsearchClient class in server module (#166)
Browse files Browse the repository at this point in the history
This commit refactors the ElasticsearchClient class located in the server module to
OpenSearchClient. References and usages throughout the rest of the codebase are
fully refactored.

Signed-off-by: Nicholas Knize <[email protected]>
  • Loading branch information
nknize committed Mar 22, 2021
1 parent ccceb38 commit e8b5a41
Show file tree
Hide file tree
Showing 116 changed files with 282 additions and 282 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@

import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.OpenSearchClient;
import org.elasticsearch.script.ScriptType;

import java.util.Map;

public class SearchTemplateRequestBuilder
extends ActionRequestBuilder<SearchTemplateRequest, SearchTemplateResponse> {

SearchTemplateRequestBuilder(ElasticsearchClient client, SearchTemplateAction action) {
SearchTemplateRequestBuilder(OpenSearchClient client, SearchTemplateAction action) {
super(client, action, new SearchTemplateRequest());
}

public SearchTemplateRequestBuilder(ElasticsearchClient client) {
public SearchTemplateRequestBuilder(OpenSearchClient client) {
this(client, SearchTemplateAction.INSTANCE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@

import org.elasticsearch.action.ActionType;
import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.OpenSearchClient;

public class RankEvalRequestBuilder extends ActionRequestBuilder<RankEvalRequest, RankEvalResponse> {

public RankEvalRequestBuilder(ElasticsearchClient client, ActionType<RankEvalResponse> action,
RankEvalRequest request) {
public RankEvalRequestBuilder(OpenSearchClient client, ActionType<RankEvalResponse> action,
RankEvalRequest request) {
super(client, action, request);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
import org.elasticsearch.action.ActionType;
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksResponse;
import org.elasticsearch.action.support.tasks.TasksRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.OpenSearchClient;

/**
* Java API support for changing the throttle on reindex tasks while they are running.
*/
public class RethrottleRequestBuilder extends TasksRequestBuilder<RethrottleRequest, ListTasksResponse, RethrottleRequestBuilder> {
public RethrottleRequestBuilder(ElasticsearchClient client,
ActionType<ListTasksResponse> action) {
public RethrottleRequestBuilder(OpenSearchClient client,
ActionType<ListTasksResponse> action) {
super(client, action, new RethrottleRequest());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

package org.elasticsearch.action;

import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.OpenSearchClient;
import org.elasticsearch.common.unit.TimeValue;

import java.util.Objects;
Expand All @@ -28,9 +28,9 @@ public abstract class ActionRequestBuilder<Request extends ActionRequest, Respon

protected final ActionType<Response> action;
protected final Request request;
protected final ElasticsearchClient client;
protected final OpenSearchClient client;

protected ActionRequestBuilder(ElasticsearchClient client, ActionType<Response> action, Request request) {
protected ActionRequestBuilder(OpenSearchClient client, ActionType<Response> action, Request request) {
Objects.requireNonNull(action, "action must not be null");
this.action = action;
this.request = request;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
package org.elasticsearch.action.admin.cluster.allocation;

import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.OpenSearchClient;

/**
* Builder for requests to explain the allocation of a shard in the cluster
Expand All @@ -30,7 +30,7 @@ public class ClusterAllocationExplainRequestBuilder
ClusterAllocationExplainResponse,
ClusterAllocationExplainRequestBuilder> {

public ClusterAllocationExplainRequestBuilder(ElasticsearchClient client, ClusterAllocationExplainAction action) {
public ClusterAllocationExplainRequestBuilder(OpenSearchClient client, ClusterAllocationExplainAction action) {
super(client, action, new ClusterAllocationExplainRequest());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
import org.elasticsearch.action.support.ActiveShardCount;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.OpenSearchClient;
import org.elasticsearch.cluster.health.ClusterHealthStatus;
import org.elasticsearch.common.Priority;
import org.elasticsearch.common.unit.TimeValue;

public class ClusterHealthRequestBuilder
extends MasterNodeReadOperationRequestBuilder<ClusterHealthRequest, ClusterHealthResponse, ClusterHealthRequestBuilder> {

public ClusterHealthRequestBuilder(ElasticsearchClient client, ClusterHealthAction action) {
public ClusterHealthRequestBuilder(OpenSearchClient client, ClusterHealthAction action) {
super(client, action, new ClusterHealthRequest());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
package org.elasticsearch.action.admin.cluster.node.hotthreads;

import org.elasticsearch.action.support.nodes.NodesOperationRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.OpenSearchClient;
import org.elasticsearch.common.unit.TimeValue;

public class NodesHotThreadsRequestBuilder
extends NodesOperationRequestBuilder<NodesHotThreadsRequest, NodesHotThreadsResponse, NodesHotThreadsRequestBuilder> {

public NodesHotThreadsRequestBuilder(ElasticsearchClient client, NodesHotThreadsAction action) {
public NodesHotThreadsRequestBuilder(OpenSearchClient client, NodesHotThreadsAction action) {
super(client, action, new NodesHotThreadsRequest());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
package org.elasticsearch.action.admin.cluster.node.info;

import org.elasticsearch.action.support.nodes.NodesOperationRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.OpenSearchClient;

public class NodesInfoRequestBuilder extends NodesOperationRequestBuilder<NodesInfoRequest, NodesInfoResponse, NodesInfoRequestBuilder> {

public NodesInfoRequestBuilder(ElasticsearchClient client, NodesInfoAction action) {
public NodesInfoRequestBuilder(OpenSearchClient client, NodesInfoAction action) {
super(client, action, new NodesInfoRequest());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
package org.elasticsearch.action.admin.cluster.node.reload;

import org.elasticsearch.action.support.nodes.NodesOperationRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.OpenSearchClient;
import org.elasticsearch.common.settings.SecureString;

/**
Expand All @@ -29,7 +29,7 @@
public class NodesReloadSecureSettingsRequestBuilder extends NodesOperationRequestBuilder<NodesReloadSecureSettingsRequest,
NodesReloadSecureSettingsResponse, NodesReloadSecureSettingsRequestBuilder> {

public NodesReloadSecureSettingsRequestBuilder(ElasticsearchClient client, NodesReloadSecureSettingsAction action) {
public NodesReloadSecureSettingsRequestBuilder(OpenSearchClient client, NodesReloadSecureSettingsAction action) {
super(client, action, new NodesReloadSecureSettingsRequest());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@

import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
import org.elasticsearch.action.support.nodes.NodesOperationRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.OpenSearchClient;

public class NodesStatsRequestBuilder
extends NodesOperationRequestBuilder<NodesStatsRequest, NodesStatsResponse, NodesStatsRequestBuilder> {

public NodesStatsRequestBuilder(ElasticsearchClient client, NodesStatsAction action) {
public NodesStatsRequestBuilder(OpenSearchClient client, NodesStatsAction action) {
super(client, action, new NodesStatsRequest());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
package org.elasticsearch.action.admin.cluster.node.tasks.cancel;

import org.elasticsearch.action.support.tasks.TasksRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.OpenSearchClient;

/**
* Builder for the request to cancel tasks running on the specified nodes
*/
public class CancelTasksRequestBuilder extends TasksRequestBuilder<CancelTasksRequest, CancelTasksResponse, CancelTasksRequestBuilder> {

public CancelTasksRequestBuilder(ElasticsearchClient client, CancelTasksAction action) {
public CancelTasksRequestBuilder(OpenSearchClient client, CancelTasksAction action) {
super(client, action, new CancelTasksRequest());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
package org.elasticsearch.action.admin.cluster.node.tasks.get;

import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.OpenSearchClient;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.tasks.TaskId;

/**
* Builder for the request to retrieve the list of tasks running on the specified nodes
*/
public class GetTaskRequestBuilder extends ActionRequestBuilder<GetTaskRequest, GetTaskResponse> {
public GetTaskRequestBuilder(ElasticsearchClient client, GetTaskAction action) {
public GetTaskRequestBuilder(OpenSearchClient client, GetTaskAction action) {
super(client, action, new GetTaskRequest());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
package org.elasticsearch.action.admin.cluster.node.tasks.list;

import org.elasticsearch.action.support.tasks.TasksRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.OpenSearchClient;

/**
* Builder for the request to retrieve the list of tasks running on the specified nodes
*/
public class ListTasksRequestBuilder extends TasksRequestBuilder<ListTasksRequest, ListTasksResponse, ListTasksRequestBuilder> {

public ListTasksRequestBuilder(ElasticsearchClient client, ListTasksAction action) {
public ListTasksRequestBuilder(OpenSearchClient client, ListTasksAction action) {
super(client, action, new ListTasksRequest());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@

import org.elasticsearch.action.ActionType;
import org.elasticsearch.action.support.nodes.NodesOperationRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.OpenSearchClient;

public class NodesUsageRequestBuilder
extends NodesOperationRequestBuilder<NodesUsageRequest, NodesUsageResponse, NodesUsageRequestBuilder> {

public NodesUsageRequestBuilder(ElasticsearchClient client, ActionType<NodesUsageResponse> action) {
public NodesUsageRequestBuilder(OpenSearchClient client, ActionType<NodesUsageResponse> action) {
super(client, action, new NodesUsageRequest());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
package org.elasticsearch.action.admin.cluster.remote;

import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.OpenSearchClient;

public final class RemoteInfoRequestBuilder extends ActionRequestBuilder<RemoteInfoRequest, RemoteInfoResponse> {

public RemoteInfoRequestBuilder(ElasticsearchClient client, RemoteInfoAction action) {
public RemoteInfoRequestBuilder(OpenSearchClient client, RemoteInfoAction action) {
super(client, action, new RemoteInfoRequest());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@

import org.elasticsearch.action.ActionType;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.OpenSearchClient;

public class CleanupRepositoryRequestBuilder extends MasterNodeOperationRequestBuilder<CleanupRepositoryRequest,
CleanupRepositoryResponse,
CleanupRepositoryRequestBuilder> {

public CleanupRepositoryRequestBuilder(ElasticsearchClient client, ActionType<CleanupRepositoryResponse> action,
String repository) {
public CleanupRepositoryRequestBuilder(OpenSearchClient client, ActionType<CleanupRepositoryResponse> action,
String repository) {
super(client, action, new CleanupRepositoryRequest(repository));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.OpenSearchClient;

/**
* Builder for unregister repository request
Expand All @@ -32,14 +32,14 @@ public class DeleteRepositoryRequestBuilder
/**
* Constructs unregister repository request builder
*/
public DeleteRepositoryRequestBuilder(ElasticsearchClient client, DeleteRepositoryAction action) {
public DeleteRepositoryRequestBuilder(OpenSearchClient client, DeleteRepositoryAction action) {
super(client, action, new DeleteRepositoryRequest());
}

/**
* Constructs unregister repository request builder with specified repository name
*/
public DeleteRepositoryRequestBuilder(ElasticsearchClient client, DeleteRepositoryAction action, String name) {
public DeleteRepositoryRequestBuilder(OpenSearchClient client, DeleteRepositoryAction action, String name) {
super(client, action, new DeleteRepositoryRequest(name));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
package org.elasticsearch.action.admin.cluster.repositories.get;

import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.OpenSearchClient;
import org.elasticsearch.common.util.ArrayUtils;

/**
Expand All @@ -32,14 +32,14 @@ public class GetRepositoriesRequestBuilder
/**
* Creates new get repository request builder
*/
public GetRepositoriesRequestBuilder(ElasticsearchClient client, GetRepositoriesAction action) {
public GetRepositoriesRequestBuilder(OpenSearchClient client, GetRepositoriesAction action) {
super(client, action, new GetRepositoriesRequest());
}

/**
* Creates new get repository request builder
*/
public GetRepositoriesRequestBuilder(ElasticsearchClient client, GetRepositoriesAction action, String... repositories) {
public GetRepositoriesRequestBuilder(OpenSearchClient client, GetRepositoriesAction action, String... repositories) {
super(client, action, new GetRepositoriesRequest(repositories));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.OpenSearchClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentType;

Expand All @@ -36,14 +36,14 @@ public class PutRepositoryRequestBuilder
/**
* Constructs register repository request
*/
public PutRepositoryRequestBuilder(ElasticsearchClient client, PutRepositoryAction action) {
public PutRepositoryRequestBuilder(OpenSearchClient client, PutRepositoryAction action) {
super(client, action, new PutRepositoryRequest());
}

/**
* Constructs register repository request for the repository with a given name
*/
public PutRepositoryRequestBuilder(ElasticsearchClient client, PutRepositoryAction action, String name) {
public PutRepositoryRequestBuilder(OpenSearchClient client, PutRepositoryAction action, String name) {
super(client, action, new PutRepositoryRequest(name));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
package org.elasticsearch.action.admin.cluster.repositories.verify;

import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.OpenSearchClient;

/**
* Builder for verify repository request
Expand All @@ -31,14 +31,14 @@ public class VerifyRepositoryRequestBuilder
/**
* Constructs unregister repository request builder
*/
public VerifyRepositoryRequestBuilder(ElasticsearchClient client, VerifyRepositoryAction action) {
public VerifyRepositoryRequestBuilder(OpenSearchClient client, VerifyRepositoryAction action) {
super(client, action, new VerifyRepositoryRequest());
}

/**
* Constructs unregister repository request builder with specified repository name
*/
public VerifyRepositoryRequestBuilder(ElasticsearchClient client, VerifyRepositoryAction action, String name) {
public VerifyRepositoryRequestBuilder(OpenSearchClient client, VerifyRepositoryAction action, String name) {
super(client, action, new VerifyRepositoryRequest(name));
}

Expand Down
Loading

0 comments on commit e8b5a41

Please sign in to comment.