2013-08-28 19:24:34 -04:00
|
|
|
[[mapping-id-field]]
|
|
|
|
=== `_id`
|
|
|
|
|
|
|
|
Each document indexed is associated with an id and a type. The `_id`
|
|
|
|
field can be used to index just the id, and possible also store it. By
|
|
|
|
default it is not indexed and not stored (thus, not created).
|
|
|
|
|
|
|
|
Note, even though the `_id` is not indexed, all the APIs still work
|
|
|
|
(since they work with the `_uid` field), as well as fetching by ids
|
|
|
|
using `term`, `terms` or `prefix` queries/filters (including the
|
|
|
|
specific `ids` query/filter).
|
|
|
|
|
|
|
|
The `_id` field can be enabled to be indexed, and possibly stored,
|
2014-09-26 06:58:12 -04:00
|
|
|
using the appropriate mapping attributes:
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"tweet" : {
|
2014-09-26 06:58:12 -04:00
|
|
|
"_id" : {
|
|
|
|
"index" : "not_analyzed",
|
|
|
|
"store" : true
|
|
|
|
}
|
2013-08-28 19:24:34 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
|