2 | About the Authors
3 | Clinton Gormley was the first user of Elasticsearch and wrote the Perl API back in 2010. When Elasticsearch formed a company in 2012, he joined as a developer and the maintainer of the Perl modules. Now Clinton spends a lot of his time designing the user interfaces and speaking and writing about Elasticsearch. He studied medicine at the University of Cape Town and lives in Barcelona.
4 | Zachary Tong has been working with Elasticsearch since 2011. During that time, he has written a number of tutorials to help beginners start using Elasticsearch. Zach is now a developer at Elasticsearch and maintains the PHP client, gives trainings, and helps customers manage clusters in production. He studied biology at Rensselaer Polytechnic Institute and now lives in South Carolina.
5 |
6 |
--------------------------------------------------------------------------------
/520_Post_Deployment/10_dynamic_settings.asciidoc:
--------------------------------------------------------------------------------
1 | [[_changing_settings_dynamically]]
2 | === 动态变更设置
3 |
4 | Elasticsearch 里很多设置都是动态的,可以通过 API 修改。需要强制重启节点(或者集群)的配置修改都要极力避免。((("post-deployment", "changing settings dynamically")))而且虽然通过静态配置项也可以完成这些变更,我们建议你还是用 API 来实现。
5 |
6 | `集群更新` API((("Cluster Update API"))) 有两种工作模式:
7 |
8 | 临时(Transient)::
9 | 这些变更在集群重启之前一直会生效。一旦整个集群重启,这些配置就被清除。
10 |
11 | 永久(Persistent)::
12 | 这些变更会永久存在直到被显式修改。即使全集群重启它们也会存活下来并覆盖掉静态配置文件里的选项。
13 |
14 | 临时或永久配置需要在 JSON 体里分别指定:
15 |
16 | [source,js]
17 | ----
18 | PUT /_cluster/settings
19 | {
20 | "persistent" : {
21 | "discovery.zen.minimum_master_nodes" : 2 <1>
22 | },
23 | "transient" : {
24 | "indices.store.throttle.max_bytes_per_sec" : "50mb" <2>
25 | }
26 | }
27 | ----
28 | <1> 这个永久设置会在全集群重启时存活下来。
29 | <2> 这个临时设置会在第一次全集群重启后被移除。
30 |
31 | 可以动态更新的设置的完整清单,请阅读 {ref}/cluster-update-settings.html[online reference docs]。
32 |
33 |
--------------------------------------------------------------------------------
/020_Distributed_Cluster/00_Intro.asciidoc:
--------------------------------------------------------------------------------
1 | [[distributed-cluster]]
2 | == 集群内的原理
3 |
4 | .补充章节
5 | ****
6 |
7 | 如前文所述,这是补充章节中第一篇介绍 Elasticsearch 在分布式((("clusters")))环境中的运行原理。
8 | 在这个章节中,我们将会介绍 _cluster_ 、 _node_ 、 _shard_ 等常用术语,Elastisearch 的扩容机制,
9 | 以及如何处理硬件故障的内容。
10 |
11 | 虽然这个章节不是必读的--您完全可以在不关注分片、副本和失效切换等内容的情况下长期使用Elasticsearch--
12 | 但是这将帮助你了解 Elasticsearch 的内部工作过程。您可以先快速阅览该章节,将来有需要时再次查看。
13 |
14 | ****
15 |
16 | ElasticSearch 的主旨是((("scalability, Elasticsearch and")))随时可用和按需扩容。
17 | 而扩容可以通过购买性能更强大((("vertical scaling, Elasticsearch and")))( _垂直扩容_ ,或 _纵向扩容_ )
18 | 或者数量更多((("horizontal scaling, Elasticsearch and")))的服务器( _水平扩容_ ,或 _横向扩容_ )来实现。
19 |
20 | 虽然 Elasticsearch 可以获益于更强大的硬件设备,但是垂直扩容是有极限的。
21 | 真正的扩容能力是来自于水平扩容--为集群添加更多的节点,并且将负载压力和稳定性分散到这些节点中。
22 |
23 | 对于大多数的数据库而言,通常需要对应用程序进行非常大的改动,才能利用上横向扩容的新增资源。
24 | 与之相反的是,ElastiSearch天生就是 _分布式的_ ,它知道如何通过管理多节点来提高扩容性和可用性。
25 | 这也意味着你的应用无需关注这个问题。
26 |
27 | 本章将讲述如何按需配置集群、节点和分片,并在硬件故障时确保数据安全。
28 |
--------------------------------------------------------------------------------
/402_Nested/31_Nested_mapping.asciidoc:
--------------------------------------------------------------------------------
1 | [[nested-mapping]]
2 | === 嵌套对象映射
3 |
4 | 设置一个字段为 `nested` 很简单 -- ((("mapping (types)", "nested object")))((("nested object mapping"))) 你只需要将字段类型 `object` 替换为 `nested` 即可:
5 |
6 | [source,json]
7 | --------------------------
8 | PUT /my_index
9 | {
10 | "mappings": {
11 | "blogpost": {
12 | "properties": {
13 | "comments": {
14 | "type": "nested", <1>
15 | "properties": {
16 | "name": { "type": "string" },
17 | "comment": { "type": "string" },
18 | "age": { "type": "short" },
19 | "stars": { "type": "short" },
20 | "date": { "type": "date" }
21 | }
22 | }
23 | }
24 | }
25 | }
26 | }
27 | --------------------------
28 | <1> `nested` 字段类型的设置参数与 `object` 相同。
29 |
30 | 这就是需要设置的一切。至此,所有 `comments` 对象会被索引在独立的嵌套文档中。可以查看 {ref}/nested.html[`nested` 类型参考文档] 获取更多详细信息。
31 |
--------------------------------------------------------------------------------
/06_Modeling_your_data.asciidoc:
--------------------------------------------------------------------------------
1 | ifndef::es_build[= placeholder6]
2 |
3 | [[modeling-your-data]]
4 |
5 | = 数据建模
6 |
7 | [partintro]
8 | --
9 |
10 | Elasticsearch 是如此与众不同,特别是如果你来自 SQL 的世界。((("modeling your data")))
11 | Elasticsearch 有非常多的优点:高性能、可扩展、近实时搜索,并支持大数据量的数据分析。一切都很容易!
12 | 只需下载并开始使用它。
13 |
14 | 但它不是魔法。为了充分利用 Elasticsearch,你需要了解它的工作机制,以及如何让它如你所需的进行工作。
15 |
16 | 和专用的关系型数据存储有所不同,Elasticsearch 并没有对处理实体之间的关系给出直接的方法。
17 | 一个关系数据库的黄金法则是 --规范化你的数据(范式)-- 但这不适用于 Elasticsearch。
18 | 在 <