mapper.asciidoc 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. [[index-modules-mapper]]
  2. == Mapper
  3. The mapper module acts as a registry for the type mapping definitions
  4. added to an index either when creating it or by using the put mapping
  5. api. It also handles the dynamic mapping support for types that have no
  6. explicit mappings pre defined. For more information about mapping
  7. definitions, check out the <<mapping,mapping section>>.
  8. [float]
  9. === Dynamic Mappings
  10. New types and new fields within types can be added dynamically just
  11. by indexing a document. When Elasticsearch encounters a new type,
  12. it creates the type using the `_default_` mapping (see below).
  13. When it encounters a new field within a type, it autodetects the
  14. datatype that the field contains and adds it to the type mapping
  15. automatically.
  16. See <<mapping-dynamic-mapping>> for details of how to control and
  17. configure dynamic mapping.
  18. [float]
  19. === Default Mapping
  20. When a new type is created (at <<indices-create-index,index creation>> time,
  21. using the <<indices-put-mapping,`put-mapping` API>> or just by indexing a
  22. document into it), the type uses the `_default_` mapping as its basis. Any
  23. mapping specified in the <<indices-create-index,`create-index`>> or
  24. <<indices-put-mapping,`put-mapping`>> request override values set in the
  25. `_default_` mapping.
  26. The default mapping definition is a plain mapping definition that is
  27. embedded within Elasticsearch:
  28. [source,js]
  29. --------------------------------------------------
  30. {
  31. _default_ : {
  32. }
  33. }
  34. --------------------------------------------------
  35. Pretty short, isn't it? Basically, everything is `_default_`ed, including the
  36. dynamic nature of the root object mapping which allows new fields to be added
  37. automatically.
  38. The default mapping can be overridden by specifying the `_default_` type when
  39. creating a new index.
  40. [float]
  41. === Mapper settings
  42. `index.mapper.dynamic` (_dynamic_)::
  43. Dynamic creation of mappings for unmapped types can be completely
  44. disabled by setting `index.mapper.dynamic` to `false`.