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,console]
  9. --------------------------------------------------
  10. PUT data/_doc/1 <1>
  11. { "count": 5 }
  12. --------------------------------------------------
  13. <1> Creates the `data` index, the `_doc` mapping type, and a field
  14. called `count` with datatype `long`.
  15. The automatic detection and addition of new fields is called
  16. _dynamic mapping_. The dynamic mapping rules can be customised to suit your
  17. purposes with:
  18. <<dynamic-field-mapping,Dynamic field mappings>>::
  19. The rules governing dynamic field detection.
  20. <<dynamic-templates,Dynamic templates>>::
  21. Custom rules to configure the mapping for dynamically added fields.
  22. TIP: <<indices-templates,Index templates>> allow you to configure the default
  23. mappings, settings and aliases for new indices, whether created
  24. automatically or explicitly.
  25. include::dynamic/field-mapping.asciidoc[]
  26. include::dynamic/templates.asciidoc[]