Getting _id field from DocLookup

I have a custom scorer plugin that needs access to the document's _id field
(not the Lucene docId). At the moment, the following always returns null:

doc().field("_id")

I have tried playing with the mapping and setting "store" to true/false,
different "index" values, etc., but to no avail. At the moment, the only
thing that works, but is horribly ugly is to parse the _uid field and split
on the "#" since the field is of the form "<_type>#<_id>".

Any ideas? Is this a bug perhaps in DocLookup?

Thanks,

Josh

--

Could it be that it is not stored?
"By default it is not indexed and not stored (thus, not created) ... the
APIs still work (since they work with the |_uid| field)"

On 9/5/2012 5:28 AM, joshdevins wrote:

I have a custom scorer plugin that needs access to the document's _id
field (not the Lucene docId). At the moment, the following always
returns null:

doc().field("_id")

I have tried playing with the mapping and setting "store" to
true/false, different "index" values, etc., but to no avail. At the
moment, the only thing that works, but is horribly ugly is to parse
the _uid field and split on the "#" since the field is of the form
"<_type>#<_id>".

Any ideas? Is this a bug perhaps in DocLookup?

Thanks,

Josh

--

--

It is stored, at least, according to my mapping it is:

{
"thething": {
"_id": {
"index": "not_analyzed",
"store": "yes"
}
}
}

On Wednesday, September 5, 2012 5:56:08 PM UTC+2, P Hill wrote:

Could it be that it is not stored?
"By default it is not indexed and not stored (thus, not created) ... the
APIs still work (since they work with the |_uid| field)"
Elasticsearch Platform — Find real-time answers at scale | Elastic

On 9/5/2012 5:28 AM, joshdevins wrote:

I have a custom scorer plugin that needs access to the document's _id
field (not the Lucene docId). At the moment, the following always
returns null:

doc().field("_id")

I have tried playing with the mapping and setting "store" to
true/false, different "index" values, etc., but to no avail. At the
moment, the only thing that works, but is horribly ugly is to parse
the _uid field and split on the "#" since the field is of the form
"<_type>#<_id>".

Any ideas? Is this a bug perhaps in DocLookup?

Thanks,

Josh

--

--

Crap, PEBKAC. Error in my test setting the mapping. Setting the _id field
to stored: true did it.

On Wednesday, September 5, 2012 6:02:16 PM UTC+2, joshdevins wrote:

It is stored, at least, according to my mapping it is:

{
"thething": {
"_id": {
"index": "not_analyzed",
"store": "yes"
}
}
}

On Wednesday, September 5, 2012 5:56:08 PM UTC+2, P Hill wrote:

Could it be that it is not stored?
"By default it is not indexed and not stored (thus, not created) ... the
APIs still work (since they work with the |_uid| field)"
Elasticsearch Platform — Find real-time answers at scale | Elastic

On 9/5/2012 5:28 AM, joshdevins wrote:

I have a custom scorer plugin that needs access to the document's _id
field (not the Lucene docId). At the moment, the following always
returns null:

doc().field("_id")

I have tried playing with the mapping and setting "store" to
true/false, different "index" values, etc., but to no avail. At the
moment, the only thing that works, but is horribly ugly is to parse
the _uid field and split on the "#" since the field is of the form
"<_type>#<_id>".

Any ideas? Is this a bug perhaps in DocLookup?

Thanks,

Josh

--

--