Created
February 8, 2011 16:50
-
-
Save emedina/816732 to your computer and use it in GitHub Desktop.
Play around ES with Groovy console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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