anchor.diff:  === Using Elasticsearch Java Clients with Shield
   
  -Elasticsearch supports two types of Java clients: _Node Client_ and _Transport Client_.
  -
  -The _Node Client_ is a cluster node that joins the cluster and receives all the cluster events, in the same manner as
  -any other cluster node. Node clients cannot be allocated shards, and therefore cannot hold data. Node clients are not
  -eligible for election as a master node in the cluster. For more information about node clients, see the
  -http://www.elastic.co/guide/en/elasticsearch/client/java-api/current/node-client.html[following section].
  -
  -Unlike the _Node Client_, the _Transport Client_ is not a node in the cluster. Yet it uses the same transport protocol
  -the cluster nodes use for inter-node communication and is therefore considered to be very efficient as it bypasses the
  -process of un/marshalling of request from/to JSON which you typically have in REST based clients (read more about
  -http://www.elastic.co/guide/en/elasticsearch/client/java-api/current/transport-client.html[_Transport Client_]).
  -
  -Shield supports both clients. This section provides configuration instructions for these clients.
  -
  -[float]
  -==== Node Client
  -
  -WARNING: While _Node Clients_ may work with Shield, since these are actual nodes in the cluster, they require access
  -         to a breadth of cluster management internal APIs. Additionally, just like all other nodes in the cluster,
  -         _Node Clients_ require the License plugin to be installed and access to Shield configuration files that contain
  -         sensitive data. For this reason, _Node Clients_ should be considered as unsafe clients. If you choose to use
  -         these clients, make sure you treat them in the same way you treat any other node in your cluster. Your
  -         application should sit next to the cluster within the same security zone.
  -
  -There are several steps for setting up this client:
  -
  -. Set the appropriate dependencies for you project
  -. Duplicate <<ref-shield-files, configuration files>> for authentication
  -. Configure the authentication token
  -. (Optional) If SSL/TLS is enabled, set up the keystore, then create and import the appropriate certificates.
  -
  -[float]
  -===== Java project dependencies
  -
  -If you plan on using the Node Client, you first need to make sure the Shield jar files (`elasticsearch-shield-1.3.0.jar`,
  -`automaton-1.11-8.jar`, `unboundid-ldapsdk-2.3.8.jar`) and the License jar file (`elasticsearch-license-1.0.0.jar`) are
  -in the classpath. You can either download the distributions, extract the jar files manually and include them in your
  -classpath, or you can pull them out of the Elasticsearch Maven repository.
  -
  -[float]
  -===== Maven Example
  -
  -The following snippet shows the configuration you will need to include in your project's `pom.xml` file:
  -
  +Shield supports the Java http://www.elastic.co/guide/en/elasticsearch/client/java-api/current/transport-client.html[transport client] for Elasticsearch. The transport client uses the same transport protocol that the cluster nodes use for inter-node communication. It is very efficient as it does not have to marshall and unmarshall JSON requests like a typical REST client.
  +
  +NOTE: Using the Java Node Client with Shield is not recommended or supported.
  +
  +[float]
  +[[transport-client]]
  +==== Configuring the Transport Client to work with Shield
  +
  +To use the transport client with Shield, you need to:
  +
  +[[java-transport-client-role]]
  +. Configure a user with the privileges required to start the transport client. A default 
  +`transport_client` role is defined in `roles.yml` that grants the `cluster:monitor/nodes/info` cluster permission. The transport client uses the node info API to fetch information about the nodes in the cluster. If the client is configured to use sniffing, you need to add the
  +`cluster:monitor/state` cluster permission to the `transport_client` role.
  +
  +. Add the Shield JAR file (`elasticsearch-shield-2.0.0.jar`) to your CLASSPATH. You can download the Shield distribution and extract the JAR file manually or you can get it from the http://maven.elasticsearch.org/releases/org/elasticsearch/elasticsearch-shield/2.0.0/elasticsearch-shield-2.0.0.jar[Elasticsearch Maven repository].
  ++
  +If you are using Maven, you need to add the Shield JAR file as a dependency in your project's `pom.xml` file:
  ++
   [source,xml]
   --------------------------------------------------------------
   <project ...>
  
positive.code:    ...
  
     <dependencies>
        <!-- add the Shield jar as a dependency -->
        <dependency>
           <groupId>org.elasticsearch</groupId>
           <artifactId>elasticsearch-shield</artifactId>
           <version>1.3.0</version>
        </dependency>
        <!-- add the License jar as a dependency -->
        <dependency>
           <groupId>org.elasticsearch</groupId>
           <artifactId>elasticsearch-license-plugin</artifactId>
           <version>1.0.0</version>
           <scope>runtime</scope>
        </dependency>
        ...
     </dependencies>
  
negative.code: 
  ShieldClient shieldClient = new ShieldClient(client);
  ClearRealmCacheResponse response = shieldClient.authc().prepareClearRealmCache()
      .realms("ldap1", "ad1") (1)
      .usernames("rdeniro")
      .get();
  ------------------------------------------------------------------------------------------------------
  
  (1) Clears the `ldap1` and `ad1` realm caches for the `rdeniro` user.
  
  
  