<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # _routing field 使用以下公式將文檔路由到索引中的特定分片: | `shard_num =?``hash``(_routing) % num_primary_shards` | 用于?**_routing?**的默認值是文檔的_id或文檔的_parent ID(如果存在)。 可以通過為每個文檔指定自定義路由值來實現自定義路由模式。 例如: | `curl -XPUT?``'localhost:9200/my_index/my_type/1?routing=user1&refresh=true&pretty'`?`-H?``'Content-Type: application/json'`?`-d' #?``1` `{` `"title"``:?``"This is a document"` `}` `'` `curl -XGET?``'localhost:9200/my_index/my_type/1?routing=user1&pretty'`?`#?``2` | | 1 | 此文檔使用?**user1**?作為其?**routing**?**value**(路由值),而不是其?**ID**。 | | 2 | 在?**[getting](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/docs-get.html)**(獲取),?**[deleting](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/docs-delete.html)**(刪除)或?**[updating](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/docs-update.html)**(更新)文檔時需要提供相同的路由值。 | 該**?_routing?**字段的值可以在查詢中訪問 :? | `curl -XGET?``'localhost:9200/my_index/_search?pretty'`?`-H?``'Content-Type: application/json'`?`-d' #?``1` `{` `"query"``: {` `"terms"``: {` `"_routing"``: [?``"user1"`?`]` `}` `}` `}` `'` | | 1 | 在_routing字段上查詢(也可以參見**?[ids?query](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/query-dsl-ids-query.html)**) | ### Searching with custom routing(使用自定義路由搜索) 自定義路由可以減少搜索的影響。 搜索請求不必分散到索引中的所有分片,而是將該請求發送到與特定路由值(或值)匹配的分片 :? | `curl -XGET?``'localhost:9200/my_index/_search?routing=user1,user2&pretty'`?`-H?``'Content-Type: application/json'`?`-d' #?``1` `{` `"query"``: {` `"match"``: {` `"title"``:?``"document"` `}` `}` `}` `'` | | 1 | 該搜索請求僅會在與user1和user2路由值相關聯的分片上執行。 | ### Making a routing value required(路由值的要求) 當使用自定義路由時,重要的是在**?[indexing](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/docs-index_.html)**(索引),?**[getting](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/docs-get.html)**(獲取),?**[deleting](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/docs-delete.html)**(刪除)或?**[updating](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/docs-update.html)**(更新)文檔時提供路由值。 忘記路由值可能導致文檔被索引在多個分片上。 作為保護措施,可以將?**_routing?**字段配置為使所有CRUD操作都需要指定路由值 :? | `curl -XPUT?``'localhost:9200/my_index2?pretty'`?`-H?``'Content-Type: application/json'`?`-d'` `{` `"mappings"``: {` `"my_type"``: {` `"_routing"``: {` `"required"``:?``true`?`#?``1` `}` `}` `}` `}` `'` `curl -XPUT?``'localhost:9200/my_index2/my_type/1?pretty'`?`-H?``'Content-Type: application/json'`?`-d' #?``2` `{` `"text"``:?``"No routing value provided"` `}` `'` | | 1 | **my_type**?文檔需要路由。 | | 2 | 此索引請求會引發一個?**routing_missing_exception**。 | ### Unique IDs with custom routing(具有自定義路由的唯一ID) 在索引指定自定義?**_routing?**的文檔時,**_id?**的唯一性不能保證在索引中的所有分片。 事實上,如果使用不同的?**_routing?**值進行索引,那么具有相同?**_id?**的文檔可能會在不同的分片上出現。 由用戶確定?**ID?**在索引中是唯一的。 ### Routing to an index partition(路由到索引分區) 可以配置索引,使得自定義路由值將轉到分片的子集,而不是單個分片。這有助于減輕最終產生不平衡群集的風險,同時還可以減少搜索的影響。 這是通過在索引創建時提供索引級別設置?***index.routing_partition_size?***來完成的。隨著分區大小的增加,數據的分布越均勻,必須以每個請求搜索更多的分片為代價。 當存在此設置時,計算分片的公式為: | `shard_num = (``hash``(_routing) +?``hash``(_id) % routing_partition_size) % num_primary_shards` | 也就是說,**_routing?**字段用于計算索引中的一組分片,然后使用?**_id?**來選擇該組內的分片。 要啟用此功能,***index.routing_partition_size?***應具有大于1且小于?***index.number_of_shards?***的值。 一旦啟用,分區索引將具有以下限制 :? * 具有父子關系的映射無法在其中創建。 * 索引中的所有映射必須設置?**_routing?**字段。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看