Skip to content

Commit a14d577

Browse files
yichao2015tangmisi
authored and
tangmisi
committed
chapter10_part8:/070_Index_Mgmt/32_Metadata_all.asciidoc (elasticsearch-cn#300)
* chapter10_part8:/070_Index_Mgmt/32_Metadata_all.asciidoc * review后修改 * 二次review后修改
1 parent 560fa91 commit a14d577

File tree

1 file changed

+9
-37
lines changed

1 file changed

+9
-37
lines changed

070_Index_Mgmt/32_Metadata_all.asciidoc

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
[[all-field]]
2-
==== Metadata: _all Field
2+
==== 元数据: _all 字段
33
4-
In <<search-lite>>, we introduced the `_all` field: a special field that
5-
indexes the ((("metadata, document", "_all field")))((("_all field", sortas="all field")))values from all other fields as one big string. The `query_string`
6-
query clause (and searches performed as `?q=john`) defaults to searching in
7-
the `_all` field if no other field is specified.
4+
在 <<search-lite>> 中,我们介绍了 `_all` 字段:一个把其它字段值((("metadata, document", "_all field")))((("_all field", sortas="all field")))当作一个大字符串来索引的特殊字段。 `query_string` 查询子句(搜索 `?q=john` )在没有指定字段时默认使用 `_all` 字段。
85
9-
The `_all` field is useful during the exploratory phase of a new application,
10-
while you are still unsure about the final structure that your documents will
11-
have. You can throw any query string at it and you have a good chance of
12-
finding the document you're after:
6+
`_all` 字段在新应用的探索阶段,当你还不清楚文档的最终结构时是比较有用的。你可以使用这个字段来做任何查询,并且有很大可能找到需要的文档:
137
148
[source,js]
159
--------------------------------------------------
@@ -22,24 +16,14 @@ GET /_search
2216
--------------------------------------------------
2317
2418
25-
As your application evolves and your search requirements become more exacting,
26-
you will find yourself using the `_all` field less and less. The `_all` field
27-
is a shotgun approach to search. By querying individual fields, you have more
28-
flexbility, power, and fine-grained control over which results are considered
29-
to be most relevant.
19+
随着应用的发展,搜索需求变得更加明确,你会发现自己越来越少使用 `_all` 字段。 `_all` 字段是搜索的应急之策。通过查询指定字段,你的查询更加灵活、强大,你也可以对相关性最高的搜索结果进行更细粒度的控制。
3020
3121
[NOTE]
3222
====
33-
One of the important factors taken into account by the
34-
<<relevance-intro,relevance algorithm>>
35-
is the length of the field: the shorter the field, the more important. A term
36-
that appears in a short `title` field is likely to be more important than the
37-
same term that appears somewhere in a long `content` field. This distinction
38-
between field lengths disappears in the `_all` field.
23+
<<relevance-intro,relevance algorithm>> 考虑的一个最重要的原则是字段的长度:字段越短越重要。 在较短的 `title` 字段中出现的短语可能比在较长的 `content` 字段中出现的短语更加重要。字段长度的区别在 `_all` 字段中不会出现。
3924
====
4025
41-
If you decide that you no longer need the `_all` field, you can disable it
42-
with this mapping:
26+
如果你不再需要 `_all` 字段,你可以通过下面的映射来禁用:
4327
4428
[source,js]
4529
--------------------------------------------------
@@ -51,17 +35,9 @@ PUT /my_index/_mapping/my_type
5135
}
5236
--------------------------------------------------
5337
38+
通过 `include_in_all` 设置来逐个控制字段是否要包含在 `_all` 字段中,((("include_in_all setting")))默认值是 `true`。在一个对象(或根对象)上设置 `include_in_all` 可以修改这个对象中的所有字段的默认行为。
5439
55-
Inclusion in the `_all` field can be controlled on a field-by-field basis
56-
by using the `include_in_all` setting, ((("include_in_all setting")))which defaults to `true`. Setting
57-
`include_in_all` on an object (or on the root object) changes the
58-
default for all fields within that object.
59-
60-
You may find that you want to keep the `_all` field around to use
61-
as a catchall full-text field just for specific fields, such as
62-
`title`, `overview`, `summary`, and `tags`. Instead of disabling the `_all`
63-
field completely, disable `include_in_all` for all fields by default,
64-
and enable it only on the fields you choose:
40+
你可能想要保留 `_all` 字段作为一个只包含某些特定字段的全文字段,例如只包含 `title`,`overview`,`summary` 和 `tags`。 相对于完全禁用 `_all` 字段,你可以为所有字段默认禁用 `include_in_all` 选项,仅在你选择的字段上启用:
6541
6642
[source,js]
6743
--------------------------------------------------
@@ -81,11 +57,7 @@ PUT /my_index/my_type/_mapping
8157
--------------------------------------------------
8258
8359
84-
Remember that the `_all` field is just((("analyzers", "configuring for all field"))) an analyzed `string` field. It
85-
uses the default analyzer to analyze its values, regardless of which
86-
analyzer has been set on the fields where the values originate. And
87-
like any `string` field, you can configure which analyzer the `_all`
88-
field should use:
60+
记住,`_all` 字段仅仅是一个((("analyzers", "configuring for all field"))) 经过分词的 `string` 字段。它使用默认分词器来分析它的值,不管这个值原本所在字段指定的分词器。就像所有 `string` 字段,你可以配置 `_all` 字段使用的分词器:
8961
9062
[source,js]
9163
--------------------------------------------------

0 commit comments

Comments
 (0)