dynamic-mapping.asciidoc 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. [[dynamic-mapping]]
  2. == Dynamic Mapping
  3. One of the most important features of Elasticsearch is that it tries to get
  4. out of your way and let you start exploring your data as quickly as possible.
  5. To index a document, you don't have to first create an index, define a mapping
  6. type, and define your fields -- you can just index a document and the index,
  7. type, and fields will spring to life automatically:
  8. [source,js]
  9. --------------------------------------------------
  10. PUT data/_doc/1 <1>
  11. { "count": 5 }
  12. --------------------------------------------------
  13. // CONSOLE
  14. <1> Creates the `data` index, the `_doc` mapping type, and a field
  15. called `count` with datatype `long`.
  16. The automatic detection and addition of new fields is called
  17. _dynamic mapping_. The dynamic mapping rules can be customised to suit your
  18. purposes with:
  19. <<dynamic-field-mapping,Dynamic field mappings>>::
  20. The rules governing dynamic field detection.
  21. <<dynamic-templates,Dynamic templates>>::
  22. Custom rules to configure the mapping for dynamically added fields.
  23. TIP: <<indices-templates,Index templates>> allow you to configure the default
  24. mappings, settings and aliases for new indices, whether created
  25. automatically or explicitly.
  26. include::dynamic/field-mapping.asciidoc[]
  27. include::dynamic/templates.asciidoc[]