meta-field.asciidoc 1015 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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,js]
  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. // CONSOLE
  22. <1> This `_meta` info can be retrieved with the
  23. <<indices-get-mapping,GET mapping>> API.
  24. The `_meta` field can be updated on an existing type using the
  25. <<indices-put-mapping,PUT mapping>> API:
  26. [source,js]
  27. --------------------------------------------------
  28. PUT my_index/_mapping
  29. {
  30. "_meta": {
  31. "class": "MyApp2::User3",
  32. "version": {
  33. "min": "1.3",
  34. "max": "1.5"
  35. }
  36. }
  37. }
  38. --------------------------------------------------
  39. // CONSOLE
  40. // TEST[continued]