_id from within AbstractDoubleSearchScript


(Alex-2) #1

Hi Shay

Is it possible to access _id from within an implementation
of AbstractDoubleSearchScript?

doc.containsKey("_id") returns true,
but doc.get("_id").asInstanceOf[StringDocFieldData].getValue is null.
I need the doc id to look up some info in another database and compute a
score for the doc.

Thanks!

Cheers
Alex


(Shay Banon) #2

By default, the ID is not indexed, but you can configure it to be indexed,
and then you can access it. Are you sure that you want to access a database
though? It will be a big perf hit to do it for each hit aggregated.

On Tue, Nov 1, 2011 at 8:58 PM, Alex
alessandro.usseglioviretta@gmail.comwrote:

Hi Shay

Is it possible to access _id from within an implementation
of AbstractDoubleSearchScript?

doc.containsKey("_id") returns true,
but doc.get("_id").asInstanceOf[StringDocFieldData].getValue is null.
I need the doc id to look up some info in another database and compute a
score for the doc.

Thanks!

Cheers
Alex


(Alex-2) #3

is setting "_id" : { index: "not_analyzed" } a good solution?

Alex


(Shay Banon) #4

Yes. Sorry, should have pointed you to how to do it...

On Tue, Nov 1, 2011 at 9:16 PM, Alex
alessandro.usseglioviretta@gmail.comwrote:

is setting "_id" : { index: "not_analyzed" } a good solution?

Alex


(Alex-2) #5

Thanks, Shay.
About the performance: I might have to limit the number of hits... I'm
going to run some tests in the following days.
Alex


(system) #6