Elasticsearch 权威指南
  • Elasticsearch 权威指南
  • 入门
    • 初识
    • 安装
    • API
    • 文档
    • 索引
    • 搜索
    • 汇总
    • 小结
    • 分布式
    • 本章总结
  • 分布式集群
    • 空集群
    • 集群健康
    • 添加索引
    • 容错移转
    • 横向扩展
    • 扩展
    • 故障恢复
  • 数据
    • 文档
    • 索引
    • Get
    • 存在
    • 更新
    • 创建
    • 删除
    • 版本控制
    • 局部更新
    • Mget
    • Bulk
    • 总结
  • 分布式文档存储
    • 路由
    • 主从互通
    • 创建索引删除
    • 获取
    • 局部更新
    • 批量请求
    • 批量格式
  • 搜索
    • 空白搜索
    • 多索引多类型
    • 分页
    • 查询语句
  • 映射与统计
    • Exact_vs_full_text
    • Inverted_index
    • Analysis
    • Mapping
    • Complex_datatypes
Powered by GitBook
On this page

Was this helpful?

  1. 分布式文档存储

获取

A document can be retrieved from a primary shard or from any of its replicas.

[[img-distrib-read]] .Retrieving a single document image::images/04-03_get.png["Retrieving a single document"]

Below we list the sequence of steps to retrieve a document from either a primary or replica shard, as depicted in <>:

  1. The client sends a get request to Node 1.

  2. The node uses the document's _id to determine that the document belongs to shard 0. Copies of shard 0 exist on all three nodes. On this occasion, it forwards the request to Node 2.

  3. Node 2 returns the document to Node 1 which returns the document to the client.

For read requests, the requesting node will choose a different shard copy on every request in order to balance the load -- it round-robins through all shard copies.

It is possible that a document has been indexed on the primary shard but has not yet been copied to the replica shards. In this case a replica might report that the document doesn't exist, while the primary would have returned the document successfully.

Previous创建索引删除Next局部更新

Last updated 5 years ago

Was this helpful?