<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之旅 廣告
                **1. 創建文檔** (1)語法1:`POST /index/_doc` ```json POST /db_01/_doc { "title": "小米手機", "category": "小米", "images": "http://www.gulixueyuan.com/xm.jpg", "price": "3999.0" } ``` 成功返回的數據如下: ```json { "_index" : "db_01", "_type" : "_doc", "_id" : "gRBajnwBWCWQahLf3sG9", # 隨機生成,相當于MySQL中的主鍵 "_version" : 1, "result" : "created", # created創建成功 "_shards" : { "total" : 2, # 分片總數 "successful" : 1, # 分片成功次數 "failed" : 0 # 分片失敗次數 }, "_seq_no" : 0, "_primary_term" : 1 } ``` (2)語法2:`POST /index/_doc/id`、`PUT /index/_doc/id` ```json POST /db_01/_doc/2 { "title": "小米手機", "category": "小米", "images": "http://www.gulixueyuan.com/xm.jpg", "price": "3999.0" } ``` 成功返回的數據如下: ```json { "_index" : "db_01", "_type" : "_doc", "_id" : "2", # id由自己定義 "_version" : 2, #對同一個id的文檔增加多次,每增加一次版本號增1 "result" : "updated", "_shards" : { "total" : 2, "successful" : 1, "failed" : 0 }, "_seq_no" : 3, "_primary_term" : 2 } ``` **2. 查看文檔** (1)根據`id`查詢文檔:`GET /index/_doc/id` ```json GET /db_01/_doc/2 ``` 成功返回的數據如下: ```json { "_index" : "db_01", "_type" : "_doc", "_id" : "2", "_version" : 2, "_seq_no" : 3, "_primary_term" : 2, "found" : true, "_source" : { "title" : "小米手機", "category" : "小米", "images" : "http://www.gulixueyuan.com/xm.jpg", "price" : "3999.0" } } ``` **3. 修改文檔** (1)根據id修改文檔:`POST /index/_doc/id`、`PUT /index/_doc/id` ```json POST /db_01/_doc/2 { "title": "小米手機", "category": "小米", "images": "http://www.gulixueyuan.com/xm.jpg", "price": "3999.0" } ``` 成功后返回如下數據: ```json { "_index" : "db_01", "_type" : "_doc", "_id" : "2", "_version" : 6, #對同一個id每修改一次,版本就會增1 "result" : "updated", "_shards" : { "total" : 2, "successful" : 1, "failed" : 0 }, "_seq_no" : 7, "_primary_term" : 2 } ``` **4. 修改字段** (1)`POST /index/_update/id` ```json POST /db_01/_update/2 { "doc": { "price": 3000.0 #修改前是3999.0 } } ``` 查看修改結果`GET /db_01/_doc/2`: ```json { "_index" : "db_01", "_type" : "_doc", "_id" : "2", "_version" : 7, "_seq_no" : 8, "_primary_term" : 2, "found" : true, "_source" : { "title" : "小米手機", "category" : "小米", "images" : "http://www.gulixueyuan.com/xm.jpg", "price" : 3000.0 } } ``` **5. 刪除文檔** 刪除一個文檔不會立即從磁盤上移除,它只是被標記成已刪除(邏輯刪除)。 (1)根據id刪除文檔:`DELETE /index/_doc/id` ```json DELETE /db_01/_doc/1 ``` 成功后返回如下數據: ```json { "_index" : "db_01", "_type" : "_doc", "_id" : "1", "_version" : 2, "result" : "deleted", "_shards" : { "total" : 2, "successful" : 1, "failed" : 0 }, "_seq_no" : 11, "_primary_term" : 2 } ```
                  <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>

                              哎呀哎呀视频在线观看