meta-field.asciidoc 1004 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. [[mapping-meta-field]]
  2. === `_meta` field
  3. A mapping type can have custom meta data associated with it. These are not
  4. used at all by Elasticsearch, but can be used to store application-specific
  5. metadata, such as the class that a document belongs to:
  6. [source,console]
  7. --------------------------------------------------
  8. PUT my_index
  9. {
  10. "mappings": {
  11. "_meta": { <1>
  12. "class": "MyApp::User",
  13. "version": {
  14. "min": "1.0",
  15. "max": "1.3"
  16. }
  17. }
  18. }
  19. }
  20. --------------------------------------------------
  21. <1> This `_meta` info can be retrieved with the
  22. <<indices-get-mapping,GET mapping>> API.
  23. The `_meta` field can be updated on an existing type using the
  24. <<indices-put-mapping,PUT mapping>> API:
  25. [source,console]
  26. --------------------------------------------------
  27. PUT my_index/_mapping
  28. {
  29. "_meta": {
  30. "class": "MyApp2::User3",
  31. "version": {
  32. "min": "1.3",
  33. "max": "1.5"
  34. }
  35. }
  36. }
  37. --------------------------------------------------
  38. // TEST[continued]