<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國際加速解決方案。 廣告
                [TOC] # 簡介 ES是依靠JSON文檔的字段類型來實現自動識別字段類型,支持的類型如下: ![](https://img.kancloud.cn/62/3e/623e7772e7ce48cc8ebe58d94d43b15d_421x435.png) ~~~ POST my_index/doc { "username":"whirly", "age":22, "birthday":"1995-01-01" } GET my_index/_mapping # 結果 { "my_index": { "mappings": { "doc": { "properties": { "age": { "type": "long" }, "birthday": { "type": "date" }, "username": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } } } } } } } ~~~ ## 日期的自動識別 * dynamic\_date\_formats 參數為自動識別的日期格式,默認為 \[ "strict\_date\_optional\_time","yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z"\] * date\_detection可以關閉日期自動識別機制 ~~~ # 自定義日期識別格式 PUT my_index { "mappings": { "_doc": { "dynamic_date_formats": ["MM/dd/yyyy"] } } } # 關閉日期自動識別機制 PUT my_index { "mappings": { "_doc": { "date_detection": false } } } ~~~ ## 數字的自動識別 * 字符串是數字時,默認不會自動識別為整形,因為字符串中出現數字完全是合理的 * numeric\_detection 參數可以開啟字符串中數字的自動識別 ## Dynamic templates 允許根據ES自動識別的數據類型、字段名等來動態設定字段類型,可以實現如下效果: * 所有字符串類型都設定為keyword類型,即不分詞 * 所有以message開頭的字段都設定為text類型,即分詞 * 所有以long\_開頭的字段都設定為long類型 * 所有自動匹配為double類型的都設定為float類型,以節省空間 **Dynamic templates API** ~~~ "dynamic_templates": [ { "my_template_name": { ... match conditions ... "mapping": { ... } } }, ... ] ~~~ 匹配規則一般有如下幾個參數: * match\_mapping\_type 匹配ES自動識別的字段類型,如boolean,long,string等 * match, unmatch 匹配字段名 * match\_pattern 匹配正則表達式 * path\_match, path\_unmatch 匹配路徑 ~~~ # double類型的字段設定為float以節省空間 PUT my_index { "mappings": { "_doc": { "dynamic_templates": [ { "integers": { "match_mapping_type": "double", "mapping": { "type": "float" } } } ] } } } ~~~ **自定義Mapping的建議** 1. 寫入一條文檔到ES的臨時索引中,獲取ES自動生成的Mapping 2. 修改步驟1得到的Mapping,自定義相關配置 3. 使用步驟2的Mapping創建實際所需索引 ## 動態映射 ~~~ PUT /library { "mappings": { "books": { "dynamic": "strict", "properties": { "title": {"type": "string"}, "name": {"type": "string", "index": "not_analyzed"}, "publish_date": {"type": "date","index": "not_analyzed"}, "price": {"type": "double"}, "number": { "type": "object", "dynamic": true } } } } } ~~~
                  <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>

                              哎呀哎呀视频在线观看