Skip to content

Commit d867e48

Browse files
luotitanmedcl
authored andcommitted
chapter41_part3: /400_Relationships/20_Denormalization.asciidoc (#67)
* 15_Application_joins.asciidoc * 第一次提交
1 parent b390183 commit d867e48

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

400_Relationships/20_Denormalization.asciidoc

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
[[denormalization]]
2-
=== Denormalizing Your Data
2+
=== 非规范化你的数据
33

4-
The way to get the best search performance out of Elasticsearch is to use it
5-
as it is intended, by((("relationships", "denormalizing your data")))((("denormalization", "denormalizing data at index time")))
6-
http://en.wikipedia.org/wiki/Denormalization[denormalizing] your data at index
7-
time. Having redundant copies of data in each document that requires access to
8-
it removes the need for joins.
94

10-
If we want to be able to find a blog post by the name of the user who wrote it,
11-
include the user's name in the blog-post document itself:
5+
使用 Elasticsearch 得到最好的搜索性能的方法是有目的的通过在索引时进行非规范化 ((("relationships", "denormalizing your data")))((("denormalization", "denormalizing data at index time")))
6+
http://en.wikipedia.org/wiki/Denormalization[denormalizing]。对每个文档保持一定数量的冗余副本可以在需要访问时避免进行关联。
127

8+
如果我们希望能够通过某个用户姓名找到他写的博客文章,可以在博客文档中包含这个用户的姓名:
139

1410
[source,json]
1511
--------------------------------
@@ -30,10 +26,9 @@ PUT /my_index/blogpost/2
3026
}
3127
}
3228
--------------------------------
33-
<1> Part of the user's data has been denormalized into the `blogpost` document.
29+
<1> 这部分用户的字段数据已被冗余到 `blogpost` 文档中。
3430

35-
Now, we can find blog posts about `relationships` by users called `John`
36-
with a single query:
31+
现在,我们通过单次查询就能够通过 `relationships` 找到用户 `John` 的博客文章。
3732

3833
[source,json]
3934
--------------------------------
@@ -50,7 +45,4 @@ GET /my_index/blogpost/_search
5045
}
5146
--------------------------------
5247

53-
The advantage of data denormalization is speed. Because each document
54-
contains all of the information that is required to determine whether it
55-
matches the query, there is no need for expensive joins.
56-
48+
数据非规范化的优点是速度快。因为每个文档都包含了所需的所有信息,当这些信息需要在查询进行匹配时,并不需要进行昂贵的联接操作。

0 commit comments

Comments
 (0)