Native Script Help

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.

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: NativeScriptFactory · GitHub

Which I call using this snippet, which builds on an existing query
that works fine: AddScriptSort_snippet · GitHub

But this is the error I get in the response: sortQueryResponse.json · GitHub

This is my config where I associate the Factory with the name "my":
sortQueryResponse.json · GitHub

Any reason why I am getting the error?

Regards,

David.

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: NativeScriptFactory · GitHub

Which I call using this snippet, which builds on an existing query
that works fine: AddScriptSort_snippet · GitHub

But this is the error I get in the response:
sortQueryResponse.json · GitHub

This is my config where I associate the Factory with the name "my":
sortQueryResponse.json · GitHub

Any reason why I am getting the error?

Regards,

David.

--

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

Apologies, this is the config link: script-config.yml · GitHub

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:NativeScriptFactory · GitHub

Which I call using this snippet, which builds on an existing query
that works fine:AddScriptSort_snippet · GitHub

But this is the error I get in the response:
sortQueryResponse.json · GitHub

This is my config where I associate the Factory with the name "my":
sortQueryResponse.json · GitHub

Any reason why I am getting the error?

Regards,

David.

--

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

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: script-config.yml · GitHub

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:NativeScriptFactory · GitHub

Which I call using this snippet, which builds on an existing query
that works fine:AddScriptSort_snippet · GitHub

But this is the error I get in the response:
sortQueryResponse.json · GitHub

This is my config where I associate the Factory with the name "my":
sortQueryResponse.json · GitHub

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

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: sortQueryResponse.json · GitHub
Factory: NativeScriptFactory · GitHub
Config: script-config.yml · GitHub - both the client node and
the servier node have this, the server node includes the needed jars
in its classpath.
Query Builder: AddScriptSort_snippet · GitHub

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:script-config.yml · GitHub

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:NativeScriptFactory · GitHub

Which I call using this snippet, which builds on an existing query
that works fine:AddScriptSort_snippet · GitHub

But this is the error I get in the response:
sortQueryResponse.json · GitHub

This is my config where I associate the Factory with the name "my":
sortQueryResponse.json · GitHub

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

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: sortQueryResponse.json · GitHub
Factory: NativeScriptFactory · GitHub
Config: script-config.yml · GitHub - both the client node and
the servier node have this, the server node includes the needed jars
in its classpath.
Query Builder: AddScriptSort_snippet · GitHub

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:script-config.yml · GitHub

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:NativeScriptFactory · GitHub

Which I call using this snippet, which builds on an existing query
that works fine:AddScriptSort_snippet · GitHub

But this is the error I get in the response:
sortQueryResponse.json · GitHub

This is my config where I associate the Factory with the name "my":
sortQueryResponse.json · GitHub

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

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:sortQueryResponse.json · GitHub
Factory:NativeScriptFactory · GitHub
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:AddScriptSort_snippet · GitHub

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:script-config.yml · GitHub

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:NativeScriptFactory · GitHub

Which I call using this snippet, which builds on an existing query
that works fine:AddScriptSort_snippet · GitHub

But this is the error I get in the response:
sortQueryResponse.json · GitHub

This is my config where I associate the Factory with the name "my":
sortQueryResponse.json · GitHub

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

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:sortQueryResponse.json · GitHub
Factory:NativeScriptFactory · GitHub
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:AddScriptSort_snippet · GitHub

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:script-config.yml · GitHub

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:NativeScriptFactory · GitHub

Which I call using this snippet, which builds on an existing query
that works fine:AddScriptSort_snippet · GitHub

But this is the error I get in the response:
sortQueryResponse.json · GitHub

This is my config where I associate the Factory with the name "my":
sortQueryResponse.json · GitHub

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