Native Script Help


(davrob) #1

Hi,

I have created a NativeScriptFactory: https://gist.github.com/989192

Which I call using this snippet, which builds on an existing query
that works fine: https://gist.github.com/989184

But this is the error I get in the response: https://gist.github.com/989204

This is my config where I associate the Factory with the name "my":

Any reason why I am getting the error?

Regards,

David.


(Shay Banon) #2

You need to set the "lang" on the query builder to "native". Also, you probably want to use the docs lookup to fetch the field (all values loaded and cached to memory), compared with fields lookup, which fetches it if it was stored from the index storage.
On Tuesday, May 24, 2011 at 8:34 PM, davrob2 wrote:

Hi,

I have created a NativeScriptFactory: https://gist.github.com/989192

Which I call using this snippet, which builds on an existing query
that works fine: https://gist.github.com/989184

But this is the error I get in the response: https://gist.github.com/989204

This is my config where I associate the Factory with the name "my":
https://gist.github.com/989204

Any reason why I am getting the error?

Regards,

David.


(Paul Loy) #3

Sorry, the config link is wrong. You posted the same link as the response
link.

On Tue, May 24, 2011 at 6:34 PM, davrob2 daviroberts@gmail.com wrote:

Hi,

I have created a NativeScriptFactory: https://gist.github.com/989192

Which I call using this snippet, which builds on an existing query
that works fine: https://gist.github.com/989184

But this is the error I get in the response:
https://gist.github.com/989204

This is my config where I associate the Factory with the name "my":
https://gist.github.com/989204

Any reason why I am getting the error?

Regards,

David.

--

Paul Loy
paul@keteracel.com
http://uk.linkedin.com/in/paulloy


(davrob) #4

Apologies, this is the config link: https://gist.github.com/989191

On May 24, 7:14 pm, Paul Loy ketera...@gmail.com wrote:

Sorry, the config link is wrong. You posted the same link as the response
link.

On Tue, May 24, 2011 at 6:34 PM, davrob2 davirobe...@gmail.com wrote:

Hi,

I have created a NativeScriptFactory:https://gist.github.com/989192

Which I call using this snippet, which builds on an existing query
that works fine:https://gist.github.com/989184

But this is the error I get in the response:
https://gist.github.com/989204

This is my config where I associate the Factory with the name "my":
https://gist.github.com/989204

Any reason why I am getting the error?

Regards,

David.

--

Paul Loy
p...@keteracel.comhttp://uk.linkedin.com/in/paulloy


(Paul Loy) #5

Shay was right, you also need a

script.native.my.lang: native

On Tue, May 24, 2011 at 7:47 PM, davrob2 daviroberts@gmail.com wrote:

Apologies, this is the config link: https://gist.github.com/989191

On May 24, 7:14 pm, Paul Loy ketera...@gmail.com wrote:

Sorry, the config link is wrong. You posted the same link as the response
link.

On Tue, May 24, 2011 at 6:34 PM, davrob2 davirobe...@gmail.com wrote:

Hi,

I have created a NativeScriptFactory:https://gist.github.com/989192

Which I call using this snippet, which builds on an existing query
that works fine:https://gist.github.com/989184

But this is the error I get in the response:
https://gist.github.com/989204

This is my config where I associate the Factory with the name "my":
https://gist.github.com/989204

Any reason why I am getting the error?

Regards,

David.

--

Paul Loy
p...@keteracel.comhttp://uk.linkedin.com/in/paulloy

--

Paul Loy
paul@keteracel.com
http://uk.linkedin.com/in/paulloy


(davrob) #6

Ok thanks for the help guys, I'm now getting a different exception
(ClassCastException[org.elasticsearch.search.lookup.FieldLookup cannot
be cast to java.lang.String]).

Response Error: https://gist.github.com/989204
Factory: https://gist.github.com/989192
Config: https://gist.github.com/989191 - both the client node and
the servier node have this, the server node includes the needed jars
in its classpath.
Query Builder: https://gist.github.com/989184

Regards,

David.

On May 24, 8:06 pm, Paul Loy ketera...@gmail.com wrote:

Shay was right, you also need a

script.native.my.lang: native

On Tue, May 24, 2011 at 7:47 PM, davrob2 davirobe...@gmail.com wrote:

Apologies, this is the config link:https://gist.github.com/989191

On May 24, 7:14 pm, Paul Loy ketera...@gmail.com wrote:

Sorry, the config link is wrong. You posted the same link as the response
link.

On Tue, May 24, 2011 at 6:34 PM, davrob2 davirobe...@gmail.com wrote:

Hi,

I have created a NativeScriptFactory:https://gist.github.com/989192

Which I call using this snippet, which builds on an existing query
that works fine:https://gist.github.com/989184

But this is the error I get in the response:
https://gist.github.com/989204

This is my config where I associate the Factory with the name "my":
https://gist.github.com/989204

Any reason why I am getting the error?

Regards,

David.

--

Paul Loy
p...@keteracel.comhttp://uk.linkedin.com/in/paulloy

--

Paul Loy
p...@keteracel.comhttp://uk.linkedin.com/in/paulloy


(Shay Banon) #7

Call either DocLookup#field or DocLookup#numeric (for numeric fields), you get back the correct class to work with.
On Tuesday, May 24, 2011 at 11:05 PM, davrob2 wrote:

Ok thanks for the help guys, I'm now getting a different exception
(ClassCastException[org.elasticsearch.search.lookup.FieldLookup cannot
be cast to java.lang.String]).

Response Error: https://gist.github.com/989204
Factory: https://gist.github.com/989192
Config: https://gist.github.com/989191 - both the client node and
the servier node have this, the server node includes the needed jars
in its classpath.
Query Builder: https://gist.github.com/989184

Regards,

David.

On May 24, 8:06 pm, Paul Loy ketera...@gmail.com wrote:

Shay was right, you also need a

script.native.my.lang: native

On Tue, May 24, 2011 at 7:47 PM, davrob2 davirobe...@gmail.com wrote:

Apologies, this is the config link:https://gist.github.com/989191

On May 24, 7:14 pm, Paul Loy ketera...@gmail.com wrote:

Sorry, the config link is wrong. You posted the same link as the response
link.

On Tue, May 24, 2011 at 6:34 PM, davrob2 davirobe...@gmail.com wrote:

Hi,

I have created a NativeScriptFactory:https://gist.github.com/989192

Which I call using this snippet, which builds on an existing query
that works fine:https://gist.github.com/989184

But this is the error I get in the response:
https://gist.github.com/989204

This is my config where I associate the Factory with the name "my":
https://gist.github.com/989204

Any reason why I am getting the error?

Regards,

David.

--

Paul Loy
p...@keteracel.comhttp://uk.linkedin.com/in/paulloy

--

Paul Loy
p...@keteracel.comhttp://uk.linkedin.com/in/paulloy


(nachiket) #8

Hi. I know this issue is resolved. But can somebody tell me what
DocLookup#field means?
Actually I am having same error and could not find any solution other
than this.

Regards.

On May 25, 1:10 am, Shay Banon shay.ba...@elasticsearch.com wrote:

Call either DocLookup#field or DocLookup#numeric (for numeric fields), you get back the correct class to work with.

On Tuesday, May 24, 2011 at 11:05 PM, davrob2 wrote:

Ok thanks for the help guys, I'm now getting a different exception
(ClassCastException[org.elasticsearch.search.lookup.FieldLookup cannot
be cast to java.lang.String]).

Response Error:https://gist.github.com/989204
Factory:https://gist.github.com/989192
Config:https://gist.github.com/989191- both the client node and
the servier node have this, the server node includes the needed jars
in its classpath.
Query Builder:https://gist.github.com/989184

Regards,

David.

On May 24, 8:06 pm, Paul Loy ketera...@gmail.com wrote:

Shay was right, you also need a

script.native.my.lang: native

On Tue, May 24, 2011 at 7:47 PM, davrob2 davirobe...@gmail.com wrote:

Apologies, this is the config link:https://gist.github.com/989191

On May 24, 7:14 pm, Paul Loy ketera...@gmail.com wrote:

Sorry, the config link is wrong. You posted the same link as the response
link.

On Tue, May 24, 2011 at 6:34 PM, davrob2 davirobe...@gmail.com wrote:

Hi,

I have created a NativeScriptFactory:https://gist.github.com/989192

Which I call using this snippet, which builds on an existing query
that works fine:https://gist.github.com/989184

But this is the error I get in the response:
https://gist.github.com/989204

This is my config where I associate the Factory with the name "my":
https://gist.github.com/989204

Any reason why I am getting the error?

Regards,

David.

--

Paul Loy
p...@keteracel.comhttp://uk.linkedin.com/in/paulloy

--

Paul Loy
p...@keteracel.comhttp://uk.linkedin.com/in/paulloy


(davrob) #9

This is what I ended up doing:

                     DocLookup doc = doc();
		 StringDocFieldData custAttField = doc.field("cusAttrIdValue");
		 String custAttrsStr = custAttField.getStringValue();

"cusAttrIdValue" is a non-analysed String field in my mapping.

David

On Jul 8, 7:28 am, nachiket bhagwat nachiketbhag...@gmail.com wrote:

Hi. I know this issue is resolved. But can somebody tell me what
DocLookup#field means?
Actually I am having same error and could not find any solution other
than this.

Regards.

On May 25, 1:10 am, Shay Banon shay.ba...@elasticsearch.com wrote:

Call either DocLookup#field or DocLookup#numeric (for numeric fields), you get back the correct class to work with.

On Tuesday, May 24, 2011 at 11:05 PM, davrob2 wrote:

Ok thanks for the help guys, I'm now getting a different exception
(ClassCastException[org.elasticsearch.search.lookup.FieldLookup cannot
be cast to java.lang.String]).

Response Error:https://gist.github.com/989204
Factory:https://gist.github.com/989192
Config:https://gist.github.com/989191-both the client node and
the servier node have this, the server node includes the needed jars
in its classpath.
Query Builder:https://gist.github.com/989184

Regards,

David.

On May 24, 8:06 pm, Paul Loy ketera...@gmail.com wrote:

Shay was right, you also need a

script.native.my.lang: native

On Tue, May 24, 2011 at 7:47 PM, davrob2 davirobe...@gmail.com wrote:

Apologies, this is the config link:https://gist.github.com/989191

On May 24, 7:14 pm, Paul Loy ketera...@gmail.com wrote:

Sorry, the config link is wrong. You posted the same link as the response
link.

On Tue, May 24, 2011 at 6:34 PM, davrob2 davirobe...@gmail.com wrote:

Hi,

I have created a NativeScriptFactory:https://gist.github.com/989192

Which I call using this snippet, which builds on an existing query
that works fine:https://gist.github.com/989184

But this is the error I get in the response:
https://gist.github.com/989204

This is my config where I associate the Factory with the name "my":
https://gist.github.com/989204

Any reason why I am getting the error?

Regards,

David.

--

Paul Loy
p...@keteracel.comhttp://uk.linkedin.com/in/paulloy

--

Paul Loy
p...@keteracel.comhttp://uk.linkedin.com/in/paulloy


(system) #10