Package org.elasticsearch.client
Class Requests
java.lang.Object
org.elasticsearch.client.Requests
A handy one stop shop for creating requests (make sure to import static this class).
-
Field Summary
Modifier and TypeFieldDescriptionstatic org.elasticsearch.common.xcontent.XContentType
The content type used to generate request builders (query / search).static org.elasticsearch.common.xcontent.XContentType
The default content type to use to generate source documents when indexing. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic BulkRequest
Creates a new bulk request.static CancelTasksRequest
Creates a nodes tasks request against one or more nodes.static CleanupRepositoryRequest
Cleanup repositorystatic ClearIndicesCacheRequest
clearIndicesCacheRequest(String... indices)
Creates a clean indices cache request.static CloseIndexRequest
closeIndexRequest(String index)
Creates a close index request.static ClusterHealthRequest
clusterHealthRequest(String... indices)
Creates a cluster health request.static ClusterRerouteRequest
static ClusterSearchShardsRequest
List all shards for the give searchstatic ClusterSearchShardsRequest
clusterSearchShardsRequest(String... indices)
List all shards for the give searchstatic ClusterStateRequest
Creates a cluster state request.static ClusterStatsRequest
Creates a cluster stats request.static ClusterUpdateSettingsRequest
static CreateIndexRequest
createIndexRequest(String index)
Creates a create index request.static CreateSnapshotRequest
createSnapshotRequest(String repository, String snapshot)
Creates new snapshotstatic DeleteIndexRequest
deleteIndexRequest(String index)
Creates a delete index request.static DeleteRepositoryRequest
Deletes registration for snapshot repositorystatic DeleteRequest
deleteRequest(String index)
Creates a delete request against a specific index.static DeleteSnapshotRequest
deleteSnapshotRequest(String repository, String... snapshots)
Deletes snapshotsstatic FlushRequest
flushRequest(String... indices)
Creates a flush indices request.static ForceMergeRequest
forceMergeRequest(String... indices)
Creates a force merge request.static GetRepositoriesRequest
getRepositoryRequest(String... repositories)
Gets snapshot repositorystatic GetRequest
getRequest(String index)
Creates a get request to get the JSON source from an index based on a type and id.static GetSnapshotsRequest
getSnapshotsRequest(String... repositories)
Gets snapshots from repositoriesstatic GetTaskRequest
Creates a get task request.static IndicesAliasesRequest
Creates an index aliases request allowing to add and remove aliases.static IndexRequest
static IndexRequest
indexRequest(String index)
Create an index request against a specific index.static IndicesExistsRequest
indicesExistsRequest(String... indices)
Creates an indices exists request.static IndicesSegmentsRequest
indicesSegmentsRequest(String... indices)
static IndicesShardStoresRequest
indicesShardStoresRequest(String... indices)
Creates an indices shard stores info request.static ListTasksRequest
Creates a nodes tasks request against all the nodes.static NodesInfoRequest
Creates a nodes info request against all the nodes.static NodesInfoRequest
nodesInfoRequest(String... nodesIds)
Creates a nodes info request against one or more nodes.static NodesStatsRequest
nodesStatsRequest(String... nodesIds)
Creates a nodes stats request against one or more nodes.static NodesUsageRequest
nodesUsageRequest(String... nodesIds)
Creates a nodes usage request against one or more nodes.static OpenIndexRequest
openIndexRequest(String index)
Creates an open index request.static PutMappingRequest
putMappingRequest(String... indices)
Create a create mapping request against one or more indices.static PutRepositoryRequest
putRepositoryRequest(String name)
Registers snapshot repositorystatic RefreshRequest
refreshRequest(String... indices)
Creates a refresh indices request.static RestoreSnapshotRequest
restoreSnapshotRequest(String repository, String snapshot)
Restores new snapshotstatic SearchRequest
searchRequest(String... indices)
Creates a search request against one or more indices.static SearchScrollRequest
searchScrollRequest(String scrollId)
Creates a search scroll request allowing to continue searching a previous search request.static SnapshotsStatusRequest
snapshotsStatusRequest(String repository)
Get status of snapshotsstatic SyncedFlushRequest
syncedFlushRequest(String... indices)
Creates a synced flush indices request.static UpdateSettingsRequest
updateSettingsRequest(String... indices)
A request to update indices settings.static UpgradeRequest
upgradeRequest(String... indices)
Creates an upgrade request.static VerifyRepositoryRequest
Verifies snapshot repository
-
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
Creates new snapshot- Parameters:
repository
- repository namesnapshot
- snapshot name- Returns:
- create snapshot request
-
getSnapshotsRequest
Gets snapshots from repositories- Parameters:
repositories
- repository names- Returns:
- get snapshot request
-
restoreSnapshotRequest
Restores new snapshot- Parameters:
repository
- repository namesnapshot
- snapshot name- Returns:
- snapshot creation request
-
deleteSnapshotRequest
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
-