<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之旅 廣告
                >[info] es對于restful的基本操作 一種軟件架構風格,而不是標準,只是提供了一組設計原則和約束條件。它主要用于客戶端和服務器交 互 類的軟件。基于這個風格設計的軟件可以更簡潔,更有層次,更易于實現緩存等機制。 ***** **基本Rest命令說明:** | method | url地址 | 描述 | | --- | --- | ---- | | PUT | localhost:9200/索引名稱/類型名稱/文檔id | 創建文檔(指定文檔id) | | POST | localhost:9200/索引名稱/類型名稱 | 創建文檔(隨機文檔id)| | DELETE | localhost:9200/索引名稱/類型名稱/文檔id | 刪除文檔 | | GET | localhost:9200/索引名稱/類型名稱/文檔id | 查詢文檔通過文檔id | | POST | localhost:9200/索引名稱/類型名稱/_search | 查詢所有數據 | | POST | localhost:9200/索引名稱/類型名稱/_update | 更新數據 | **字段類型說明:** * **字符串類型:** text 、 keyword * **數值類型:** long, integer, short, byte, double, float, half_float, scaled_float | 類型 | 長度(字節) | 范圍 | 默認值 | 說明 | | --- | --- | ---- | ---- | ---- | | byte | 8 | -128 ~ 127 | | 有符號 | | short | 16 | -32768 ~ 32767 | | 有符號 | | integer | 32 | -21億 ~ 21億 | | 有符號 | | long | 64 | | | 有符號 | | float | 32 | | | 單精度浮點數 | | double | 64| | | 雙精度浮點數 | | half_float | 16 | | | 半精度浮點數 | | scaled_float | | | | 縮放類型的浮點數(如:price字段只需要精確到分,57.34縮放因子為100,存儲結果為:5734) | * **日期類型:** date PUT /索引名/~類型名~/文檔id {請求體} * **布爾值類型:** boolean 二進制類型 binary * **其他:** **可以使用 restful 風格:** ``` curl -XPUT http://ip:9200/test2/type2/2 '{}' 等 ``` >[info] 代碼高亮 highlight:代碼高亮 fields:指定字段 pre_tags:自定義標簽開始 post_tags:自定義標簽結束 ``` GET /test1/type1/_search { "query": { "match": { "name": "初心" } }, "highlight": { "pre_tags": "<span style='color:red;'>", "post_tags": "</span>", "fields": { "name":{} } } } ``` >[info] 索引 * **查詢所有索引** ``` GET /_cat/indices?v ``` * **創建索引** ``` PUT /shop ``` * **刪除索引** 通過DELETE 命令實現刪除、 根據你的請求來判斷是刪除索引還是刪除文檔記錄! ``` DELETE /shop ``` * **獲取當前/全部索引 mapping setting 信息** ``` GET _all/_mapping GET _all/_settings GET /shop/_mapping GET /shop/_settings ``` >[info] 基本使用 * **創建索引/類型/數據(自動識別類型)** ``` PUT /test1/type1/1 { "name":"初心", "age":18 } ``` **在 es-head 控制端查看創建的索引:** ![](https://img.kancloud.cn/52/2d/522dd2f27ec41b3fbbafd050b157d121_623x271.png) ![](https://img.kancloud.cn/74/c8/74c83cc2e6d916a89782ecdc225bb329_927x312.png) ***** * **指定字段的類型:** ``` PUT /test1 { "mappings": { "properties": { "name":{ "type":"text" }, "aget":{ "type":"long" }, "birthdy":{ "type":"date" } } } } # 添加數據集 POST /test1/_doc/1 { "id":"1", "aget":18, "birthdy":"2023-10-21", "name":"張三" } ``` ![](https://img.kancloud.cn/6b/4d/6b4d01ba0e13c4a80676ef92ada503d6_1258x473.png) ![](https://img.kancloud.cn/91/27/9127e3d9b0f93af38c18d24e80039aa4_881x280.png) * **創建索引對應的mapping(如數據庫 schema 組織和結構) 和 setting(配置)** ``` # 字段說明: // id 字段自增id // good_sn 商品SKU // good_name 商品名稱 // good_introduction 商品簡介 // good_descript 商品詳情 PUT /shop { "mappings": { "properties": { "id": { "type": "long", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } }, "good_sn": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } }, "good_name": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } }, "good_introduction": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } }, "good_descript": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } } } }, "settings": { "index": { "number_of_shards": 5, "number_of_replicas": 1 } } } ```
                  <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>

                              哎呀哎呀视频在线观看