forked from elastic/elasticsearch-definitive-guide
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
chapter10_part8:/070_Index_Mgmt/32_Metadata_all.asciidoc #300
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
medcl
merged 3 commits into
elasticsearch-cn:cn
from
yichao2015:chapter/chapter10_part8
Oct 17, 2016
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,9 @@ | ||
[[all-field]] | ||
==== Metadata: _all Field | ||
==== 元数据: _all 字段 | ||
|
||
In <<search-lite>>, we introduced the `_all` field: a special field that | ||
indexes the ((("metadata, document", "_all field")))((("_all field", sortas="all field")))values from all other fields as one big string. The `query_string` | ||
query clause (and searches performed as `?q=john`) defaults to searching in | ||
the `_all` field if no other field is specified. | ||
在 <<search-lite>> 中,我们介绍了 `_all` 字段:一个把其它字段值((("metadata, document", "_all field")))((("_all field", sortas="all field")))当作一个大字符串来索引的特殊字段。 `query_string` 查询子句(搜索 `?q=john` )在没有指定字段时默认使用 `_all` 字段。 | ||
|
||
The `_all` field is useful during the exploratory phase of a new application, | ||
while you are still unsure about the final structure that your documents will | ||
have. You can throw any query string at it and you have a good chance of | ||
finding the document you're after: | ||
`_all` 字段在新应用的探索阶段,当你还不清楚文档的最终结构时是比较有用的。你可以使用这个字段来做任何查询,并且有很大可能找到需要的文档: | ||
|
||
[source,js] | ||
-------------------------------------------------- | ||
|
@@ -22,24 +16,14 @@ GET /_search | |
-------------------------------------------------- | ||
|
||
|
||
As your application evolves and your search requirements become more exacting, | ||
you will find yourself using the `_all` field less and less. The `_all` field | ||
is a shotgun approach to search. By querying individual fields, you have more | ||
flexbility, power, and fine-grained control over which results are considered | ||
to be most relevant. | ||
随着应用的发展,搜索需求变得更加明确,你会发现自己使用 `_all` 字段越来越少。 `_all` 字段是搜索的应急之策。通过查询指定字段,你可以更加灵活,强大和精准的控制搜索结果,提高相关性。 | ||
|
||
[NOTE] | ||
==== | ||
One of the important factors taken into account by the | ||
<<relevance-intro,relevance algorithm>> | ||
is the length of the field: the shorter the field, the more important. A term | ||
that appears in a short `title` field is likely to be more important than the | ||
same term that appears somewhere in a long `content` field. This distinction | ||
between field lengths disappears in the `_all` field. | ||
<<relevance-intro,relevance algorithm>> 考虑的一个最重要的原则是字段的长度:字段越短越重要。 在较短的 `title` 字段中出现的短语可能比在较长的 `content` 字段中出现的短语更加重要。字段长度的区别在 `_all` 字段中不会出现。 | ||
==== | ||
|
||
If you decide that you no longer need the `_all` field, you can disable it | ||
with this mapping: | ||
如果你不再需要 `_all` 字段,你可以通过下面的映射来禁用: | ||
|
||
[source,js] | ||
-------------------------------------------------- | ||
|
@@ -51,17 +35,9 @@ PUT /my_index/_mapping/my_type | |
} | ||
-------------------------------------------------- | ||
|
||
通过 `include_in_all` 设置来逐个控制字段是否要包含在 `_all` 字段中,((("include_in_all setting")))默认值是 `true`。在一个对象(或根对象)上设置 `include_in_all` 可以修改这个对象中的所有字段的默认行为。 | ||
|
||
Inclusion in the `_all` field can be controlled on a field-by-field basis | ||
by using the `include_in_all` setting, ((("include_in_all setting")))which defaults to `true`. Setting | ||
`include_in_all` on an object (or on the root object) changes the | ||
default for all fields within that object. | ||
|
||
You may find that you want to keep the `_all` field around to use | ||
as a catchall full-text field just for specific fields, such as | ||
`title`, `overview`, `summary`, and `tags`. Instead of disabling the `_all` | ||
field completely, disable `include_in_all` for all fields by default, | ||
and enable it only on the fields you choose: | ||
你可能想要保留 `_all` 字段作为一个全文字段,例如 `title`,`overview`,`summary` 和 `tags`。 相对于完全禁用 `_all` 字段,你可以为所有字段默认禁用 `include_in_all` 选项,仅在你选择的字段上启用: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 你可能想要保留 |
||
|
||
[source,js] | ||
-------------------------------------------------- | ||
|
@@ -81,11 +57,7 @@ PUT /my_index/my_type/_mapping | |
-------------------------------------------------- | ||
|
||
|
||
Remember that the `_all` field is just((("analyzers", "configuring for all field"))) an analyzed `string` field. It | ||
uses the default analyzer to analyze its values, regardless of which | ||
analyzer has been set on the fields where the values originate. And | ||
like any `string` field, you can configure which analyzer the `_all` | ||
field should use: | ||
记住,`_all` 字段仅仅是一个((("analyzers", "configuring for all field"))) 进过分词的 `string` 字段。它使用默认分词器来分析它的值,不管这个值原本所在字段指定的分词器。就像所有 `string` 字段,你可以配置 `_all` 字段使用的分词器: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 进过分词的 --》 经过分词的 |
||
|
||
[source,js] | ||
-------------------------------------------------- | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使用
_all
字段越来越少 -->越来越少使用_all
字段;“你可以更加灵活,强大和精准的控制搜索结果,提高相关性。”这么理解好像也没错,但我个人觉得翻译成"你的查询更加灵活、强大,你也可以对相关性最高的搜索结果进行更细粒度的控制"比较符合原意。你斟酌一下吧,不是必改~