Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@emedina
Created February 8, 2011 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save emedina/816732 to your computer and use it in GitHub Desktop.
Save emedina/816732 to your computer and use it in GitHub Desktop.
Play around ES with Groovy console
@GrabResolver(name='Codehaus', root='http://repository.codehaus.org')
@GrabResolver(name='Codehaus.Snapshots', root='http://snapshots.repository.codehaus.org')
@GrabResolver(name='Codehaus.Snapshots', root='http://oss.sonatype.org/content/repositories/releases/')
@GrabResolver(name='Codehaus.Snapshots', root='http://repo1.maven.org/maven2/')
@Grapes([
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.5.1'),
@Grab(group='org.elasticsearch', module='elasticsearch-client-groovy', version='0.10.0'),
@Grab(group='org.elasticsearch', module='elasticsearch-lang-groovy', version='0.14.3'),
@Grab(group='org.apache.lucene', module='lucene-highlighter', version='3.0.3'),
@GrabExclude(group='xerces', module='xercesImpl')])
import groovyx.net.http.*
import static groovyx.net.http.Method.*
import static groovyx.net.http.ContentType.*
import org.elasticsearch.common.xcontent.*
import static org.elasticsearch.common.xcontent.XContentFactory.*
import org.elasticsearch.groovy.node.GNode
import org.elasticsearch.groovy.client.*
import org.elasticsearch.groovy.node.GNodeBuilder
import static org.elasticsearch.groovy.node.GNodeBuilder.*
// Conectar con el servidor ES.
GNode node = nodeBuilder().node();
GClient client = node.client();
println client
node.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment