Package org.elasticsearch.client
Class Requests
java.lang.Object
org.elasticsearch.client.Requests
public class Requests
extends java.lang.Object
A handy one stop shop for creating requests (make sure to import static this class).
-
Field Summary
Fields Modifier and Type Field Description static org.elasticsearch.common.xcontent.XContentType
CONTENT_TYPE
The content type used to generate request builders (query / search).static org.elasticsearch.common.xcontent.XContentType
INDEX_CONTENT_TYPE
The default content type to use to generate source documents when indexing. -
Constructor Summary
Constructors Constructor Description Requests()
-
Method Summary
Modifier and Type Method Description static BulkRequest
bulkRequest()
Creates a new bulk request.static CancelTasksRequest
cancelTasksRequest()
Creates a nodes tasks request against one or more nodes.static CleanupRepositoryRequest
cleanupRepositoryRequest(java.lang.String name)
Cleanup repositorystatic ClearIndicesCacheRequest
clearIndicesCacheRequest(java.lang.String... indices)
Creates a clean indices cache request.static CloseIndexRequest
closeIndexRequest(java.lang.String index)
Creates a close index request.static ClusterHealthRequest
clusterHealthRequest(java.lang.String... indices)
Creates a cluster health request.static ClusterRerouteRequest
clusterRerouteRequest()
static ClusterSearchShardsRequest
clusterSearchShardsRequest()
List all shards for the give searchstatic ClusterSearchShardsRequest
clusterSearchShardsRequest(java.lang.String... indices)
List all shards for the give searchstatic ClusterStateRequest
clusterStateRequest()
Creates a cluster state request.static ClusterStatsRequest
clusterStatsRequest()
Creates a cluster stats request.static ClusterUpdateSettingsRequest
clusterUpdateSettingsRequest()
static CreateIndexRequest
createIndexRequest(java.lang.String index)
Creates a create index request.static CreateSnapshotRequest
createSnapshotRequest(java.lang.String repository, java.lang.String snapshot)
Creates new snapshotstatic DeleteIndexRequest
deleteIndexRequest(java.lang.String index)
Creates a delete index request.static DeleteRepositoryRequest
deleteRepositoryRequest(java.lang.String name)
Deletes registration for snapshot repositorystatic DeleteRequest
deleteRequest(java.lang.String index)
Creates a delete request against a specific index.static DeleteSnapshotRequest
deleteSnapshotRequest(java.lang.String repository, java.lang.String... snapshots)
Deletes snapshotsstatic FlushRequest
flushRequest(java.lang.String... indices)
Creates a flush indices request.static ForceMergeRequest
forceMergeRequest(java.lang.String... indices)
Creates a force merge request.static GetRepositoriesRequest
getRepositoryRequest(java.lang.String... repositories)
Gets snapshot repositorystatic GetRequest
getRequest(java.lang.String index)
Creates a get request to get the JSON source from an index based on a type and id.static GetSnapshotsRequest
getSnapshotsRequest(java.lang.String repository)
Gets snapshots from repositorystatic GetTaskRequest
getTaskRequest()
Creates a get task request.static IndicesAliasesRequest
indexAliasesRequest()
Creates an index aliases request allowing to add and remove aliases.static IndexRequest
indexRequest()
static IndexRequest
indexRequest(java.lang.String index)
Create an index request against a specific index.static IndicesExistsRequest
indicesExistsRequest(java.lang.String... indices)
Creates an indices exists request.static IndicesSegmentsRequest
indicesSegmentsRequest(java.lang.String... indices)
static IndicesShardStoresRequest
indicesShardStoresRequest(java.lang.String... indices)
Creates an indices shard stores info request.static ListTasksRequest
listTasksRequest()
Creates a nodes tasks request against all the nodes.static NodesInfoRequest
nodesInfoRequest()
Creates a nodes info request against all the nodes.static NodesInfoRequest
nodesInfoRequest(java.lang.String... nodesIds)
Creates a nodes info request against one or more nodes.static NodesStatsRequest
nodesStatsRequest(java.lang.String... nodesIds)
Creates a nodes stats request against one or more nodes.static NodesUsageRequest
nodesUsageRequest(java.lang.String... nodesIds)
Creates a nodes usage request against one or more nodes.static OpenIndexRequest
openIndexRequest(java.lang.String index)
Creates an open index request.static PutMappingRequest
putMappingRequest(java.lang.String... indices)
Create a create mapping request against one or more indices.static PutRepositoryRequest
putRepositoryRequest(java.lang.String name)
Registers snapshot repositorystatic RefreshRequest
refreshRequest(java.lang.String... indices)
Creates a refresh indices request.static RestoreSnapshotRequest
restoreSnapshotRequest(java.lang.String repository, java.lang.String snapshot)
Restores new snapshotstatic SearchRequest
searchRequest(java.lang.String... indices)
Creates a search request against one or more indices.static SearchScrollRequest
searchScrollRequest(java.lang.String scrollId)
Creates a search scroll request allowing to continue searching a previous search request.static SnapshotsStatusRequest
snapshotsStatusRequest(java.lang.String repository)
Get status of snapshotsstatic SyncedFlushRequest
syncedFlushRequest(java.lang.String... indices)
Creates a synced flush indices request.static UpdateSettingsRequest
updateSettingsRequest(java.lang.String... indices)
A request to update indices settings.static UpgradeRequest
upgradeRequest(java.lang.String... indices)
Creates an upgrade request.static VerifyRepositoryRequest
verifyRepositoryRequest(java.lang.String name)
Verifies snapshot repositoryMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
CONTENT_TYPE
public static org.elasticsearch.common.xcontent.XContentType CONTENT_TYPEThe content type used to generate request builders (query / search). -
INDEX_CONTENT_TYPE
public static org.elasticsearch.common.xcontent.XContentType INDEX_CONTENT_TYPEThe default content type to use to generate source documents when indexing.
-
-
Constructor Details
-
Requests
public Requests()
-
-
Method Details
-
indexRequest
-
indexRequest
Create an index request against a specific index. Note theIndexRequest.type(String)
must be set as well and optionally theIndexRequest.id(String)
.- Parameters:
index
- The index name to index the request against- Returns:
- The index request
- See Also:
Client.index(org.elasticsearch.action.index.IndexRequest)
-
deleteRequest
Creates a delete request against a specific index. Note theDeleteRequest.type(String)
andDeleteRequest.id(String)
must be set.- Parameters:
index
- The index name to delete from- Returns:
- The delete request
- See Also:
Client.delete(org.elasticsearch.action.delete.DeleteRequest)
-
bulkRequest
Creates a new bulk request. -
getRequest
Creates a get request to get the JSON source from an index based on a type and id. Note, theGetRequest.type(String)
andGetRequest.id(String)
must be set.- Parameters:
index
- The index to get the JSON source from- Returns:
- The get request
- See Also:
Client.get(org.elasticsearch.action.get.GetRequest)
-
searchRequest
Creates a search request against one or more indices. Note, the search source must be set either using the actual JSON search source, or theSearchSourceBuilder
.- Parameters:
indices
- The indices to search against. Usenull
or_all
to execute against all indices- Returns:
- The search request
- See Also:
Client.search(org.elasticsearch.action.search.SearchRequest)
-
searchScrollRequest
Creates a search scroll request allowing to continue searching a previous search request.- Parameters:
scrollId
- The scroll id representing the scrollable search- Returns:
- The search scroll request
- See Also:
Client.searchScroll(org.elasticsearch.action.search.SearchScrollRequest)
-
indicesSegmentsRequest
-
indicesShardStoresRequest
Creates an indices shard stores info request.- Parameters:
indices
- The indices to get shard store information on- Returns:
- The indices shard stores request
- See Also:
IndicesAdminClient.shardStores(IndicesShardStoresRequest)
-
indicesExistsRequest
Creates an indices exists request.- Parameters:
indices
- The indices to check if they exists or not.- Returns:
- The indices exists request
- See Also:
IndicesAdminClient.exists(org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest)
-
createIndexRequest
Creates a create index request.- Parameters:
index
- The index to create- Returns:
- The index create request
- See Also:
IndicesAdminClient.create(org.elasticsearch.action.admin.indices.create.CreateIndexRequest)
-
deleteIndexRequest
Creates a delete index request.- Parameters:
index
- The index to delete- Returns:
- The delete index request
- See Also:
IndicesAdminClient.delete(org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest)
-
closeIndexRequest
Creates a close index request.- Parameters:
index
- The index to close- Returns:
- The delete index request
- See Also:
IndicesAdminClient.close(org.elasticsearch.action.admin.indices.close.CloseIndexRequest)
-
openIndexRequest
Creates an open index request.- Parameters:
index
- The index to open- Returns:
- The delete index request
- See Also:
IndicesAdminClient.open(org.elasticsearch.action.admin.indices.open.OpenIndexRequest)
-
putMappingRequest
Create a create mapping request against one or more indices.- Parameters:
indices
- The indices to create mapping. Usenull
or_all
to execute against all indices- Returns:
- The create mapping request
- See Also:
IndicesAdminClient.putMapping(org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest)
-
indexAliasesRequest
Creates an index aliases request allowing to add and remove aliases.- Returns:
- The index aliases request
-
refreshRequest
Creates a refresh indices request.- Parameters:
indices
- The indices to refresh. Usenull
or_all
to execute against all indices- Returns:
- The refresh request
- See Also:
IndicesAdminClient.refresh(org.elasticsearch.action.admin.indices.refresh.RefreshRequest)
-
flushRequest
Creates a flush indices request.- Parameters:
indices
- The indices to flush. Usenull
or_all
to execute against all indices- Returns:
- The flush request
- See Also:
IndicesAdminClient.flush(org.elasticsearch.action.admin.indices.flush.FlushRequest)
-
syncedFlushRequest
Creates a synced flush indices request.- Parameters:
indices
- The indices to sync flush. Usenull
or_all
to execute against all indices- Returns:
- The synced flush request
- See Also:
IndicesAdminClient.syncedFlush(SyncedFlushRequest)
-
forceMergeRequest
Creates a force merge request.- Parameters:
indices
- The indices to force merge. Usenull
or_all
to execute against all indices- Returns:
- The force merge request
- See Also:
IndicesAdminClient.forceMerge(org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest)
-
upgradeRequest
Creates an upgrade request.- Parameters:
indices
- The indices to upgrade. Usenull
or_all
to execute against all indices- Returns:
- The upgrade request
- See Also:
IndicesAdminClient.upgrade(UpgradeRequest)
-
clearIndicesCacheRequest
Creates a clean indices cache request.- Parameters:
indices
- The indices to clean their caches. Usenull
or_all
to execute against all indices- Returns:
- The request
-
updateSettingsRequest
A request to update indices settings.- Parameters:
indices
- The indices to update the settings for. Usenull
or_all
to executed against all indices.- Returns:
- The request
-
clusterStateRequest
Creates a cluster state request.- Returns:
- The cluster state request.
- See Also:
ClusterAdminClient.state(org.elasticsearch.action.admin.cluster.state.ClusterStateRequest)
-
clusterRerouteRequest
-
clusterUpdateSettingsRequest
-
clusterHealthRequest
Creates a cluster health request.- Parameters:
indices
- The indices to provide additional cluster health information for. Usenull
or_all
to execute against all indices- Returns:
- The cluster health request
- See Also:
ClusterAdminClient.health(org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest)
-
clusterSearchShardsRequest
List all shards for the give search -
clusterSearchShardsRequest
List all shards for the give search -
nodesInfoRequest
Creates a nodes info request against all the nodes.- Returns:
- The nodes info request
- See Also:
ClusterAdminClient.nodesInfo(org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest)
-
nodesInfoRequest
Creates a nodes info request against one or more nodes. Passnull
or an empty array for all nodes.- Parameters:
nodesIds
- The nodes ids to get the status for- Returns:
- The nodes info request
- See Also:
ClusterAdminClient.nodesStats(org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest)
-
nodesStatsRequest
Creates a nodes stats request against one or more nodes. Passnull
or an empty array for all nodes.- Parameters:
nodesIds
- The nodes ids to get the stats for- Returns:
- The nodes info request
- See Also:
ClusterAdminClient.nodesStats(org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest)
-
nodesUsageRequest
Creates a nodes usage request against one or more nodes. Passnull
or an empty array for all nodes.- Parameters:
nodesIds
- The nodes ids to get the usage for- Returns:
- The nodes usage request
- See Also:
ClusterAdminClient.nodesUsage(org.elasticsearch.action.admin.cluster.node.usage.NodesUsageRequest)
-
clusterStatsRequest
Creates a cluster stats request.- Returns:
- The cluster stats request
- See Also:
ClusterAdminClient.clusterStats(org.elasticsearch.action.admin.cluster.stats.ClusterStatsRequest)
-
listTasksRequest
Creates a nodes tasks request against all the nodes.- Returns:
- The nodes tasks request
- See Also:
ClusterAdminClient.listTasks(ListTasksRequest)
-
getTaskRequest
Creates a get task request.- Returns:
- The nodes tasks request
- See Also:
ClusterAdminClient.getTask(GetTaskRequest)
-
cancelTasksRequest
Creates a nodes tasks request against one or more nodes. Passnull
or an empty array for all nodes.- Returns:
- The nodes tasks request
- See Also:
ClusterAdminClient.cancelTasks(CancelTasksRequest)
-
putRepositoryRequest
Registers snapshot repository- Parameters:
name
- repository name- Returns:
- repository registration request
-
getRepositoryRequest
Gets snapshot repository- Parameters:
repositories
- names of repositories- Returns:
- get repository request
-
deleteRepositoryRequest
Deletes registration for snapshot repository- Parameters:
name
- repository name- Returns:
- delete repository request
-
cleanupRepositoryRequest
Cleanup repository- Parameters:
name
- repository name- Returns:
- cleanup repository request
-
verifyRepositoryRequest
Verifies snapshot repository- Parameters:
name
- repository name- Returns:
- repository verification request
-
createSnapshotRequest
public static CreateSnapshotRequest createSnapshotRequest(java.lang.String repository, java.lang.String snapshot)Creates new snapshot- Parameters:
repository
- repository namesnapshot
- snapshot name- Returns:
- create snapshot request
-
getSnapshotsRequest
Gets snapshots from repository- Parameters:
repository
- repository name- Returns:
- get snapshot request
-
restoreSnapshotRequest
public static RestoreSnapshotRequest restoreSnapshotRequest(java.lang.String repository, java.lang.String snapshot)Restores new snapshot- Parameters:
repository
- repository namesnapshot
- snapshot name- Returns:
- snapshot creation request
-
deleteSnapshotRequest
public static DeleteSnapshotRequest deleteSnapshotRequest(java.lang.String repository, java.lang.String... snapshots)Deletes snapshots- Parameters:
snapshots
- snapshot namesrepository
- repository name- Returns:
- delete snapshot request
-
snapshotsStatusRequest
Get status of snapshots- Parameters:
repository
- repository name- Returns:
- snapshot status request
-