- Elastic Cloud Enterprise - Elastic Cloud on your Infrastructure: other versions:
- What Is Elastic Cloud Enterprise?
- Getting Started
- Configuring Your Installation
- Securing Your Installation
- Monitoring Your Installation
- Administering Your Installation
- Administering Clusters
- Use Cases
- Troubleshooting
- API Reference
- Clusters - Elasticsearch - CRUD
- Clusters - Elasticsearch - CRUD - Configuration
- Clusters - Elasticsearch - Commands
- Clusters - Kibana - CRUD
- Clusters - Kibana - CRUD - Configuration
- Clusters - Kibana - Commands
- Platform
- Platform - Allocators
- Platform - Configuration - Security
- Platform - Configuration - TLS
- Platform - Repository - CRUD
- Stack - CRUD
- Definitions
AllocatedInstanceStatus
AllocatorCapacity
AllocatorCapacityMemory
AllocatorHealthStatus
AllocatorInformation2
AllocatorMoveRequest
AllocatorOverview
AllocatorZoneInformation
BasicFailedReply
BasicFailedReplyElement
ClusterCredentials
ClusterCrudResponse
ClusterInstanceDiskInfo
ClusterInstanceInfo
ClusterInstanceMemoryInfo
ClusterMetadataInfo
ClusterPlanStepInfo
ClusterPlanStepLogMessageInfo
ClusterTopologyInfo
CreateElasticsearchClusterRequest
CreateKibanaClusterRequest
ElasticsearchClusterInfo
ElasticsearchClusterPlan
ElasticsearchClusterPlanInfo
ElasticsearchClusterPlansInfo
ElasticsearchClusterRole
ElasticsearchClusterSecurityInfo
ElasticsearchClusterSettings
ElasticsearchClusterTopologyElement
ElasticsearchClusterUser
ElasticsearchClustersInfo
ElasticsearchConfiguration
ElasticsearchHttpUserSettings
ElasticsearchInfo
ElasticsearchMasterElement
ElasticsearchMasterInfo
ElasticsearchMonitoringInfo
ElasticsearchNodeType
ElasticsearchPlanControlConfiguration
ElasticsearchReplicaElement
ElasticsearchScriptTypeSettings
ElasticsearchScriptingUserSettings
ElasticsearchShardElement
ElasticsearchShardsInfo
ElasticsearchSystemSettings
ElasticsearchUserBundle
ElasticsearchUserPlugin
EmptyResponse
EnrollmentTokenRequest
GrowShrinkStrategyConfig
Hyperlink
InstanceMoveRequest
JSON
KibanaClusterInfo
KibanaClusterPlan
KibanaClusterPlanInfo
KibanaClusterPlansInfo
KibanaClusterTopologyElement
KibanaClustersInfo
KibanaConfiguration
KibanaPlanControlConfiguration
KibanaSubClusterInfo
KibanaSystemSettings
ListEnrollmentTokenElement
ListEnrollmentTokenReply
ManagedMonitoringSettings
ManagedSnapshotSettings
PlanStrategy
PlatformInfo
PlatformServiceImageInfo
PlatformServiceInfo
RepositoryConfig
RepositoryConfigs
RequestEnrollmentTokenReply
RestoreSnapshotApiConfiguration
RestoreSnapshotConfiguration
RestoreSnapshotRepoConfiguration
RollingStrategyConfig
SnapshotRepositoryConfiguration
SnapshotStatusInfo
StackVersionArchiveProcessingError
StackVersionArchiveProcessingResult
StackVersionConfig
StackVersionConfigPost
StackVersionConfigs
StackVersionElasticsearchConfig
StackVersionKibanaConfig
StackVersionTemplateFileHash
StackVersionTemplateInfo
TargetElasticsearchCluster
TiebreakerTopologyElement
TlsPublicCertChain
TransientElasticsearchPlanConfiguration
TransientKibanaPlanConfiguration
- Script Reference
- Release Notes
- About This Product
It is time to say goodbye: This version of Elastic Cloud Enterprise has reached end-of-life (EOL) and is no longer supported.
The documentation for this version is no longer being maintained. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Configure the Java Transport Client
editConfigure the Java Transport Client
editYou can connect to an X-Pack or Shield protected cluster using the transport client. To learn more, see Java Client and Security and Using Elasticsearch Java Clients with Shield.
The only addition you need when using Elastic Cloud Enterprise is to add a header indicating which cluster to route the connections to.
Here is an example of how to create a transport client to connect to Elastic Cloud Enterprise:
// Build the settings for our client. String clusterId = "ac01aa2425e4a5bafdebf5100af3e9b37401055b"; // Your cluster ID here String region = "us-east-1"; // Your region here boolean enableSsl = true; Settings settings = Settings.settingsBuilder() .put("transport.ping_schedule", "5s") //.put("transport.sniff", false) // Disabled by default and *must* be disabled. .put("cluster.name", clusterId) .put("action.bulk.compress", false) .put("shield.transport.ssl", enableSsl) .put("request.headers.X-Found-Cluster", clusterId) .put("shield.user", "username:password") // your shield username and password .build(); String hostname = clusterId + "." + region + ".aws.found.io"; // Instantiate a TransportClient and add the cluster to the list of addresses to connect to. // Only port 9343 (SSL-encrypted) is currently supported. Client client = TransportClient.builder() .addPlugin(ShieldPlugin.class) .settings(settings) .build() .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(hostname), 9343));
The example is for an ES 2.1 cluster. See GitHub for examples that work with other versions.
You need to add the Shield JAR to your classpath. Examples of how to do this with various build systems are available in the Shield documentation.