Skip to content

chapter10_part12:/070_Index_Mgmt/45_Default_Mapping.asciidoc #299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 21, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions 070_Index_Mgmt/45_Default_Mapping.asciidoc
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
[[default-mapping]]
=== Default Mapping
=== 缺省映射

Often, all types in an index share similar fields and settings. ((("mapping (types)", "default")))((("default mapping"))) It can be
more convenient to specify these common settings in the `_default_` mapping,
instead of having to repeat yourself every time you create a new type. The
`_default_` mapping acts as a template for new types. All types created
_after_ the `_default_` mapping will include all of these default settings,
unless explicitly overridden in the type mapping itself.
通常,一个索引中的所有类型共享相同的字段和设置。 ((("mapping (types)", "default")))((("default mapping"))) `_default_` 映射更加方便地指定通用设置,而不是每次创建新类型时都要重复设置。 `_default_` 映射是新类型的模板。在设置 `_default_` 映射之后创建的所有类型都将应用这些缺省的设置,除非类型在自己的映射中明确覆盖这些设置。

For instance, we can disable the `_all` field for all types,((("_all field", sortas="all field"))) using the
`_default_` mapping, but enable it just for the `blog` type, as follows:
例如,我们可以使用 `_default_` 映射为所有的类型禁用 `_all` 字段,((("_all field", sortas="all field"))) 而只在 `blog` 类型启用:

[source,js]
--------------------------------------------------
Expand All @@ -28,5 +22,4 @@ PUT /my_index
// SENSE: 070_Index_Mgmt/45_Default_mapping.json


The `_default_` mapping can also be a good place to specify index-wide
<<dynamic-templates,dynamic templates>>.
`_default_` 映射也是一个指定索引 <<dynamic-templates,dynamic templates>> 的好方法。