id-field.asciidoc 811 B

123456789101112131415161718192021222324252627
  1. [[mapping-id-field]]
  2. === `_id`
  3. Each document indexed is associated with an id and a type. The `_id`
  4. field can be used to index just the id, and possible also store it. By
  5. default it is not indexed and not stored (thus, not created).
  6. Note, even though the `_id` is not indexed, all the APIs still work
  7. (since they work with the `_uid` field), as well as fetching by ids
  8. using `term`, `terms` or `prefix` queries/filters (including the
  9. specific `ids` query/filter).
  10. The `_id` field can be enabled to be indexed, and possibly stored,
  11. using the appropriate mapping attributes:
  12. [source,js]
  13. --------------------------------------------------
  14. {
  15. "tweet" : {
  16. "_id" : {
  17. "index" : "not_analyzed",
  18. "store" : true
  19. }
  20. }
  21. }
  22. --------------------------------------------------