How to include the _id field in the _source

Hello,

My projects uses CouchDB and thus each document contains a _id fields
that is uses for couch.
Usually the value for the _id is the [type + dash + number]. e.g
"Location-7".
I also have (in each document) and Id field which holds the integer
value. e.g 7.
In ES I don't need the long string _id used for couch, so I defined (I'm
using NEST):
IdProperty = "id"
And so, my documents are stored like this: /index/Locations/7 instead of *
/index/Locations/Location-7*
The problem is that ES disregards the _id field all together.

Is there a way to tell ES to serialize the _id field as if it was any
other field?

Thanks.
Liron

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

You can use any field as the ID by using using the path option:
http://www.elasticsearch.org/guide/reference/mapping/id-field/ You can also
change the analyzer if you want, or just leave the field as not analyzed
(ideally).

Not sure what you mean by "And so, my documents are stored like this:
/index/Locations/7 instead of /index/Locations/Location-7". Fields are
stored, not documents.

Cheers,

Ivan

On Sat, Aug 24, 2013 at 8:32 AM, Liron Cohen cliron1@gmail.com wrote:

Hello,

My projects uses CouchDB and thus each document contains a _id fields
that is uses for couch.
Usually the value for the _id is the [type + dash + number]. e.g
"Location-7".
I also have (in each document) and Id field which holds the integer
value. e.g 7.
In ES I don't need the long string _id used for couch, so I defined (I'm
using NEST):
IdProperty = "id"
And so, my documents are stored like this: /index/Locations/7 instead
of /index/Locations/Location-7
The problem is that ES disregards the _id field all together.

Is there a way to tell ES to serialize the _id field as if it was any
other field?

Thanks.
Liron

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.