Hi all,
This is the second time I post this question. It is VERY URGENT. Could some one help me with it?
I have a Script Filters defined in the couchdb river.
In this script I need to refer to a field of the documents which has special
characters on it, e.g. '-'
So the field would be, for example: 'number-of-houses'
How can I refer to this field from the Script Filter ??
In a normal javascript in a view I would use doc['number-of-houses'], but in
the Script Filters I don't know...
I tried:
Do you refer to a script defined in the river when you create it? Using
ctx['doc']['number-of-houses'] shoudl work. How do you create teh river?
Maybe you do it with curl and use ' to denote the body of the message?
Hi all,
This is the second time I post this question. It is VERY URGENT. Could some
one help me with it?
I have a Script Filters defined in the couchdb river.
In this script I need to refer to a field of the documents which has
special
characters on it, e.g. '-'
So the field would be, for example: 'number-of-houses'
How can I refer to this field from the Script Filter ??
In a normal javascript in a view I would use doc['number-of-houses'], but
in
the Script Filters I don't know...
I tried:
Hi,
many thanks for the reply (!!!)
You are right, I am using curl to create the river and and use ' to denote the body of the message. Should I do it in another way?
I tried the ctx['doc']['number-of-houses'] in my curl code but still ES gives the same error:
[2012-03-26 00:25:11,982][WARN ][river.couchdb ] [Rusty Collins] [cou
chdb][database1] failed to script process {id=74a18d549947f264d0d8b553cf005d81,
doc={_rev=1-967a00dff5e02add41819138abb3284d, _id=74a18d549947f264d0d8b553cf005d
81}, seq=46, changes=[{rev=1-967a00dff5e02add41819138abb3284d}]}, ignoring
org.mozilla.javascript.EcmaError: ReferenceError: "doc" is not defined. (Script1
.js#1)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.jav
a:3785)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.jav
a:3763)
at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java
:3848)
at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1781)
at org.mozilla.javascript.gen.Script1_js_1._c_script_0(Script1.js:1)
at org.mozilla.javascript.gen.Script1_js_1.call(Script1.js)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:4
26)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:317
8)
at org.mozilla.javascript.gen.Script1_js_1.call(Script1.js)
at org.mozilla.javascript.gen.Script1_js_1.exec(Script1.js)
at org.elasticsearch.script.javascript.JavaScriptScriptEngineService$Jav
aScriptExecutableScript.run(JavaScriptScriptEngineService.java:186)
at org.elasticsearch.river.couchdb.CouchdbRiver.processLine(CouchdbRiver
.java:236)
at org.elasticsearch.river.couchdb.CouchdbRiver.access$500(CouchdbRiver.
java:64)
at org.elasticsearch.river.couchdb.CouchdbRiver$Indexer.run(CouchdbRiver
.java:329)
at java.lang.Thread.run(Unknown Source)
[2012-03-26 00:25:12,043][INFO ][cluster.metadata ] [Rusty Collins] [_ri
ver] update_mapping [database1] (dynamic)
[2012-03-26 00:27:07,258][INFO ][cluster.metadata ] [Rusty Collins] [dat
abase1] deleting index
[2012-03-26 00:27:14,296][INFO ][cluster.metadata ] [Rusty Collins] [_ri
ver] deleting index
[2012-03-26 00:27:14,298][INFO ][river.couchdb ] [Rusty Collins] [cou
chdb][database1] closing couchdb stream river
Hi,
many thanks for the reply (!!!)
You are right, I am using curl to create the river and and use ' to denote
the body of the message. Should I do it in another way?
I tried the ctx['doc']['number-of-houses'] in my curl code but still ES
gives the same error:
[2012-03-26 00:25:11,982][WARN ][river.couchdb ] [Rusty Collins]
[cou
chdb][database1] failed to script process
{id=74a18d549947f264d0d8b553cf005d81,
doc={_rev=1-967a00dff5e02add41819138abb3284d,
_id=74a18d549947f264d0d8b553cf005d
81}, seq=46, changes=[{rev=1-967a00dff5e02add41819138abb3284d}]}, ignoring
org.mozilla.javascript.EcmaError: ReferenceError: "doc" is not defined.
(Script1
.js#1)
at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.jav
a:3785)
at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.jav
a:3763)
at
org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java
:3848)
at
org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1781)
at org.mozilla.javascript.gen.Script1_js_1._c_script_0(Script1.js:1)
at org.mozilla.javascript.gen.Script1_js_1.call(Script1.js)
at
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:4
26)
at
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:317
8)
at org.mozilla.javascript.gen.Script1_js_1.call(Script1.js)
at org.mozilla.javascript.gen.Script1_js_1.exec(Script1.js)
at
org.elasticsearch.script.javascript.JavaScriptScriptEngineService$Jav
aScriptExecutableScript.run(JavaScriptScriptEngineService.java:186)
at
org.elasticsearch.river.couchdb.CouchdbRiver.processLine(CouchdbRiver
.java:236)
at
org.elasticsearch.river.couchdb.CouchdbRiver.access$500(CouchdbRiver.
java:64)
at
org.elasticsearch.river.couchdb.CouchdbRiver$Indexer.run(CouchdbRiver
.java:329)
at java.lang.Thread.run(Unknown Source)
[2012-03-26 00:25:12,043][INFO ][cluster.metadata ] [Rusty Collins]
[_ri
ver] update_mapping [database1] (dynamic)
[2012-03-26 00:27:07,258][INFO ][cluster.metadata ] [Rusty Collins]
[dat
abase1] deleting index
[2012-03-26 00:27:14,296][INFO ][cluster.metadata ] [Rusty Collins]
[_ri
ver] deleting index
[2012-03-26 00:27:14,298][INFO ][river.couchdb ] [Rusty Collins]
[cou
chdb][database1] closing couchdb stream river
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.