| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 | [[client]]== ClientObtaining an Elasticsearch Groovy `GClient` (a `GClient` is a simplewrapper on top of the Java `Client`) is simple. The most common way toget a client is by starting an embedded `Node` which acts as a nodewithin the cluster.[[node-client]]=== Node ClientA Node based client is the simplest form to get a `GClient` to startexecuting operations against Elasticsearch.[source,groovy]--------------------------------------------------import org.elasticsearch.groovy.client.GClientimport org.elasticsearch.groovy.node.GNodeimport static org.elasticsearch.groovy.node.GNodeBuilder.nodeBuilder// on startupGNode node = nodeBuilder().node();GClient client = node.client();// on shutdownnode.close();--------------------------------------------------Since Elasticsearch allows to configure it using JSON based settings,the configuration itself can be done using a closure that represent theJSON:[source,groovy]--------------------------------------------------import org.elasticsearch.groovy.node.GNodeimport org.elasticsearch.groovy.node.GNodeBuilderimport static org.elasticsearch.groovy.node.GNodeBuilder.*// on startupGNodeBuilder nodeBuilder = nodeBuilder();nodeBuilder.settings {    node {        client = true    }    cluster {        name = "test"    }}GNode node = nodeBuilder.node()// on shutdownnode.stop().close()--------------------------------------------------
 |