Apologies if this is a silly error on my part, but I keep getting the
following error when running the ES sample code:
Node started
Caught: groovy.lang.MissingMethodException: No signature of method:
org.elasticsearch.common.xcontent.XContentBuilder.map() is applicable
for argument types: (java.lang.String) values: [this is a tweet]
Possible solutions: map(java.util.Map), wait(), dump(), any(),
wait(long), value(java.lang.String)
at
org.elasticsearch.groovy.common.xcontent.GXContentBuilder.buildAsBytes(GXContentBuilder.groovy:
64)
at org.elasticsearch.groovy.client.GClient
$__clinit__closure3.doCall(GClient.groovy:65)
at EsTwitterTest$_run_closure1.doCall(EsTwitterTest.groovy:25)
at EsTwitterTest$_run_closure1.doCall(EsTwitterTest.groovy)
at org.elasticsearch.groovy.client.GClient.index(GClient.groovy:182)
at EsTwitterTest.run(EsTwitterTest.groovy:21)
The code I'm trying to run is as follows:
def startNode() {
def nodeBuilder = new org.elasticsearch.groovy.node.GNodeBuilder()
nodeBuilder.settings {
node {
local = true
}
gateway {
type = "none"
}
}
nodeBuilder.node()
}
def node = startNode()
println "settings $node.settings.asMap"
println "Node started"
future = node.client.index {
index "twitter"
type "tweet"
id "1"
source {
user = "kimchy"
message = "this is a tweet"
}
}
println "Indexed $future.response.index/$future.response.type/
$future.response.id"
node.close()
I've played with various permutations of this code, and find that the
only thing that fixes it is if I add a:
complex {
foo = "bar"
}
in the source { } block. Also creating the node in the various ways
doesn't make any difference. I got this error running it from my IDE
(Intellij IDEA) and from the command line.
Are you running it as a script or as a groovy class/code (donnno the correct term for it). If as a script, then you might want to set GXContentBuilder.rootResolveStrategy to a different value than Closure.OWNER_FIRST.
Basically, I think the problem you get is in converting Groovy Closures into json (using elasticsearch XContent framework). I basically copied the Grails json builder as is into GXContentBuilder, so it should behave the same. Not a groovy expert...
-shay.banon
On Thursday, April 28, 2011 at 3:09 PM, Jondow wrote:
Apologies if this is a silly error on my part, but I keep getting the
following error when running the ES sample code:
Node started
Caught: groovy.lang.MissingMethodException: No signature of method:
org.elasticsearch.common.xcontent.XContentBuilder.map() is applicable
for argument types: (java.lang.String) values: [this is a tweet]
Possible solutions: map(java.util.Map), wait(), dump(), any(),
wait(long), value(java.lang.String)
at
org.elasticsearch.groovy.common.xcontent.GXContentBuilder.buildAsBytes(GXContentBuilder.groovy:
64)
at org.elasticsearch.groovy.client.GClient
$__clinit__closure3.doCall(GClient.groovy:65)
at EsTwitterTest$_run_closure1.doCall(EsTwitterTest.groovy:25)
at EsTwitterTest$_run_closure1.doCall(EsTwitterTest.groovy)
at org.elasticsearch.groovy.client.GClient.index(GClient.groovy:182)
at EsTwitterTest.run(EsTwitterTest.groovy:21)
The code I'm trying to run is as follows:
def startNode() {
def nodeBuilder = new org.elasticsearch.groovy.node.GNodeBuilder()
nodeBuilder.settings {
node {
local = true
}
gateway {
type = "none"
}
}
nodeBuilder.node()
}
def node = startNode()
println "settings $node.settings.asMap"
println "Node started"
future = node.client.index {
index "twitter"
type "tweet"
id "1"
source {
user = "kimchy"
message = "this is a tweet"
}
}
println "Indexed $future.response.index/$future.response.type/
$future.response.id"
node.close()
I've played with various permutations of this code, and find that the
only thing that fixes it is if I add a:
complex {
foo = "bar"
}
in the source { } block. Also creating the node in the various ways
doesn't make any difference. I got this error running it from my IDE
(Intellij IDEA) and from the command line.
Are you running it as a script or as a groovy class/code (donnno the correct term for it). If as a script, then you might want to set GXContentBuilder.rootResolveStrategy to a different value than Closure.OWNER_FIRST.
Basically, I think the problem you get is in converting Groovy Closures into json (using elasticsearch XContent framework). I basically copied the Grails json builder as is into GXContentBuilder, so it should behave the same. Not a groovy expert...
-shay.banonOn Thursday, April 28, 2011 at 3:09 PM, Jondow wrote:
Apologies if this is a silly error on my part, but I keep getting the
following error when running the ES sample code:
Node started
Caught: groovy.lang.MissingMethodException: No signature of method:
org.elasticsearch.common.xcontent.XContentBuilder.map() is applicable
for argument types: (java.lang.String) values: [this is a tweet]
Possible solutions: map(java.util.Map), wait(), dump(), any(),
wait(long), value(java.lang.String)
at
org.elasticsearch.groovy.common.xcontent.GXContentBuilder.buildAsBytes(GXContentBuilder.groovy:
64)
at org.elasticsearch.groovy.client.GClient
$__clinit__closure3.doCall(GClient.groovy:65)
at EsTwitterTest$_run_closure1.doCall(EsTwitterTest.groovy:25)
at EsTwitterTest$_run_closure1.doCall(EsTwitterTest.groovy)
at org.elasticsearch.groovy.client.GClient.index(GClient.groovy:182)
at EsTwitterTest.run(EsTwitterTest.groovy:21)
The code I'm trying to run is as follows:
def startNode() {
def nodeBuilder = new org.elasticsearch.groovy.node.GNodeBuilder()
nodeBuilder.settings {
node {
local = true
}
gateway {
type = "none"
}
}
nodeBuilder.node()
}
def node = startNode()
println "settings $node.settings.asMap"
println "Node started"
future = node.client.index {
index "twitter"
type "tweet"
id "1"
source {
user = "kimchy"
message = "this is a tweet"
}
}
println "Indexed $future.response.index/$future.response.type/
$future.response.id"
node.close()
I've played with various permutations of this code, and find that the
only thing that fixes it is if I add a:
complex {
foo = "bar"
}
in the source { } block. Also creating the node in the various ways
doesn't make any difference. I got this error running it from my IDE
(Intellij IDEA) and from the command line.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.