<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # Delete API ## Delete API(刪除接口) delete API允許基于指定的ID來從索引庫中刪除一個JSON文件。下面演示了從一個叫`twitter`的索引庫的`tweet`?type下刪除文檔,`id`是`1`: ``` $ curl -XDELETE 'http://localhost:9200/twitter/tweet/1' ``` 上述刪除操作的結果是: ``` { "_shards" : { "total" : 10, "failed" : 0, "successful" : 10 }, "found" : true, "_index" : "twitter", "_type" : "tweet", "_id" : "1", "_version" : 2, "result": "deleted" } ``` ## 版本 索引的每個文檔都被標記了版本。當刪除文檔時, 可以通過指定`version`來確保我們試圖刪除一個實際上已被刪除的文檔時,它在此期間并沒有改變。在文檔中執行的每個寫入操作,包括刪除,都會使其版本遞增。 ## 路由 在創建索引文檔時如果使用了控制路由的能力,為了刪除文檔,也應當提供路由值。例如: ``` $ curl -XDELETE 'http://localhost:9200/twitter/tweet/1?routing=kimchy' ``` 以上將刪除ID為1的tweet,但會根據用戶路由。請注意,如果刪除路由值不正確,會導致文檔無法刪除。 當映射的`_routing`被設定為`required`且沒有指定的路由值時,刪除API將拋出`RoutingMissingException`并拒絕該請求。 ## Parent `parent`參數可以被設置,這將基本上與設定路由參數是相同的。 請注意,刪除父文檔不會自動刪除其子文檔。根據給定的父文檔ID刪除所有子文件的一種方法是,通過在創建文檔索引時自動生成的`_parent`字段來使用[根據查詢條件刪除API](https://aqlu.gitbooks.io/elasticsearch-reference/content/Document_APIS/Delete_By_Query_API.html)進行刪除,它的格式是`parent_type#parent_id`。 當刪除子文檔,必須指定其父ID,否則該刪除請求將被拒絕和拋出一個`RoutingMissingException`異常。 ## 自動創建索引 如果索引庫之前沒有創建,刪除操作將自動創建一個索引庫(參見[創建索引API](https://aqlu.gitbooks.io/elasticsearch-reference/content/Indices_APIs/Create_Index.html)來手動創建索引),并且如果沒有創建類型時,會根據指定的類型名與動態映射類型來自動創建類型(參見[put mapping](https://aqlu.gitbooks.io/elasticsearch-reference/content/Indices_APIs/Put_Mapping.html)來手動創建類型映射)。 ## 分布式 刪除操作被散列到一個特定的分片id。然后它被重定向到該ID組內的主分片,和副本分片(如果需要的話)。 ## 等待活動分片 當進行的刪除請求,你可以設置`wait_for_active_shards`參數來要求必須最少達到幾個可用的分片才能開始處理刪除請求。進一步的細節和使用示例見[這里](https://aqlu.gitbooks.io/elasticsearch-reference/content/Document_APIS/Index_API.html#index-wait-for-active-shards)。 ## 刷新 用來控制本次的變化能夠被搜索可見。參見:[refresh](https://aqlu.gitbooks.io/elasticsearch-reference/content/Document_APIS/refresh.html)。 ## 超時 在執行刪除操作時,分配給執行刪除操作的主分片可能無法使用。有些方面的原因可能是主分片正在從倉庫恢復或進行搬遷。默認情況下,刪除操作在返回失敗與錯誤之前將等待1分鐘讓主分片成為可用的。該`timeout`參數可用于明確指定等待多長時間。這里是將其設置為5分鐘的一個示例: ``` $ curl -XDELETE 'http://localhost:9200/twitter/tweet/1?timeout=5m' ```
                  <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>

                              哎呀哎呀视频在线观看