Simple 'create client' type script throws exception - what am I missing?

I'm playing around with ES in the Grails console executing the
following:

import org.elasticsearch.groovy.node.GNode
import org.elasticsearch.groovy.node.GNodeBuilder
import static org.elasticsearch.groovy.node.GNodeBuilder.*

// on startup

GNodeBuilder nodeBuilder = nodeBuilder();
nodeBuilder.settings {
node {
client = true
}
cluster {
name = "test"
}
}

GNode node = nodeBuilder.node()

// on shutdown
node.stop().close()

But when I run that, I get the following exception:
Exception thrown

groovy.lang.MissingMethodException: No signature of method: static
org.elasticsearch.common.xcontent.XContentFactory.contentBinaryBuilder()
is applicable for argument types:
(org.elasticsearch.common.xcontent.XContentType$1) values: [JSON]

at

org.elasticsearch.groovy.common.xcontent.GXContentBuilder.buildAsBytes(GXContentBuilder.groovy:
63)

at org.elasticsearch.groovy.common.xcontent.GXContentBuilder

$buildAsBytes$0.callCurrent(Unknown Source)

at

org.elasticsearch.groovy.common.xcontent.GXContentBuilder.buildAsBytes(GXContentBuilder.groovy:
59)

at org.elasticsearch.groovy.common.xcontent.GXContentBuilder

$buildAsBytes.call(Unknown Source)

at

org.elasticsearch.groovy.node.GNodeBuilder.settings(GNodeBuilder.groovy:
57)

at org.elasticsearch.groovy.node.GNodeBuilder$settings.call(Unknown

Source)

at ConsoleScript2.run(ConsoleScript2:22)

Why would there be an issue using JSON?

I should add that I have now added all the lucene JAR's in the
elasticsearch/lib folder as well as the es groovy client JAR. Is there
something else I'm missing?

Regards,
Darryl

Is there a chance that you are using a different version of the
elasticsearch groovy jar and the core elasticsearch jar?

On Fri, Nov 12, 2010 at 11:14 PM, Jondow djpentz@gmail.com wrote:

I'm playing around with ES in the Grails console executing the
following:

import org.elasticsearch.groovy.node.GNode
import org.elasticsearch.groovy.node.GNodeBuilder
import static org.elasticsearch.groovy.node.GNodeBuilder.*

// on startup

GNodeBuilder nodeBuilder = nodeBuilder();
nodeBuilder.settings {
node {
client = true
}
cluster {
name = "test"
}
}

GNode node = nodeBuilder.node()

// on shutdown
node.stop().close()

But when I run that, I get the following exception:
Exception thrown

groovy.lang.MissingMethodException: No signature of method: static
org.elasticsearch.common.xcontent.XContentFactory.contentBinaryBuilder()
is applicable for argument types:
(org.elasticsearch.common.xcontent.XContentType$1) values: [JSON]

   at

org.elasticsearch.groovy.common.xcontent.GXContentBuilder.buildAsBytes(GXContentBuilder.groovy:
63)

   at org.elasticsearch.groovy.common.xcontent.GXContentBuilder

$buildAsBytes$0.callCurrent(Unknown Source)

   at

org.elasticsearch.groovy.common.xcontent.GXContentBuilder.buildAsBytes(GXContentBuilder.groovy:
59)

   at org.elasticsearch.groovy.common.xcontent.GXContentBuilder

$buildAsBytes.call(Unknown Source)

   at

org.elasticsearch.groovy.node.GNodeBuilder.settings(GNodeBuilder.groovy:
57)

   at org.elasticsearch.groovy.node.GNodeBuilder$settings.call(Unknown

Source)

   at ConsoleScript2.run(ConsoleScript2:22)

Why would there be an issue using JSON?

I should add that I have now added all the lucene JAR's in the
elasticsearch/lib folder as well as the es groovy client JAR. Is there
something else I'm missing?

Regards,
Darryl

Hi Shay,

That's exactly what the problem was. I downloaded the 0.13 snapshot
and built from source and now the same (previously problematic) code
works just fine. Thanks for your help.

  • Darryl

On Nov 13, 11:12 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Is there a chance that you are using a different version of the
elasticsearch groovy jar and the core elasticsearch jar?

On Fri, Nov 12, 2010 at 11:14 PM, Jondow djpe...@gmail.com wrote:

I'm playing around with ES in the Grails console executing the
following:

import org.elasticsearch.groovy.node.GNode
import org.elasticsearch.groovy.node.GNodeBuilder
import static org.elasticsearch.groovy.node.GNodeBuilder.*

// on startup

GNodeBuilder nodeBuilder = nodeBuilder();
nodeBuilder.settings {
node {
client = true
}
cluster {
name = "test"
}
}

GNode node = nodeBuilder.node()

// on shutdown
node.stop().close()

But when I run that, I get the following exception:
Exception thrown

groovy.lang.MissingMethodException: No signature of method: static
org.elasticsearch.common.xcontent.XContentFactory.contentBinaryBuilder()
is applicable for argument types:
(org.elasticsearch.common.xcontent.XContentType$1) values: [JSON]

   at

org.elasticsearch.groovy.common.xcontent.GXContentBuilder.buildAsBytes(GXContentBuilder.groovy:
63)

   at org.elasticsearch.groovy.common.xcontent.GXContentBuilder

$buildAsBytes$0.callCurrent(Unknown Source)

   at

org.elasticsearch.groovy.common.xcontent.GXContentBuilder.buildAsBytes(GXContentBuilder.groovy:
59)

   at org.elasticsearch.groovy.common.xcontent.GXContentBuilder

$buildAsBytes.call(Unknown Source)

   at

org.elasticsearch.groovy.node.GNodeBuilder.settings(GNodeBuilder.groovy:
57)

   at org.elasticsearch.groovy.node.GNodeBuilder$settings.call(Unknown

Source)

   at ConsoleScript2.run(ConsoleScript2:22)

Why would there be an issue using JSON?

I should add that I have now added all the lucene JAR's in the
elasticsearch/lib folder as well as the es groovy client JAR. Is there
something else I'm missing?

Regards,
Darryl