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

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                1. 定制dynamic策略 > true:遇到陌生字段,就進行dynamic mapping > false:遇到陌生字段,就忽略 > strict:遇到陌生字段,就報錯 ~~~ PUT /my_index { "mappings": { "my_type": { "dynamic": "strict", # 插入不存在的字段,報錯 "properties": { "title": { "type": "text" }, "address": { "type": "object", "dynamic": "true" # 遇到不存在的字段,自動映射 } } } } } ~~~ ~~~ PUT /my_index/my_type/1 { "title": "my article", "content": "this is my article", "address": { "province": "guangdong", "city": "guangzhou" } } ~~~ 報錯:因為插入了不存在的字段 ~~~ { "error": { "root_cause": [ { "type": "strict_dynamic_mapping_exception", "reason": "mapping set to strict, dynamic introduction of [content] within [my_type] is not allowed" } ], "type": "strict_dynamic_mapping_exception", "reason": "mapping set to strict, dynamic introduction of [content] within [my_type] is not allowed" }, "status": 400 } ~~~ 因為address設置"dynamic": "true" 允許插入不存在的字段,并自動mapping,插入成功 ~~~ PUT /my_index/my_type/1 { "title": "my article", "address": { "province": "guangdong", "city": "guangzhou" } } ~~~ ~~~ GET /my_index/_mapping/my_type { "my_index": { "mappings": { "my_type": { "dynamic": "strict", # 整個type的dynamic:strict,不允許插入不存在的字段 "properties": { "address": { "dynamic": "true", # address的dynamic為true,所以address字段中允許插入新的字段 "properties": { "city": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } }, "province": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } } } }, "title": { "type": "text" } } } } } } ~~~ 2. 定制dynamic mapping策略 (1)date_detection > 默認會按照一定格式識別date,比如yyyy-MM-dd。但是如果某個field先過來一個2017-01-01的值,就會被自動dynamic mapping成date,后面如果再來一個"hello world"之類的值,就會報錯。可以手動關閉某個type的date_detection,如果有需要,自己手動指定某個field為date類型。 ~~~ PUT /my_index/_mapping/my_type { "date_detection": false } ~~~ (2)定制自己的dynamic mapping template(type level) ~~~ PUT /my_index { "mappings": { "my_type": { "dynamic_templates": [ { "en": { "match": "*_en", # 索引下,復合這個模式的field,就用這個模板映射 "match_mapping_type": "string", "mapping": { "type": "string", # 把符合模式的字段映射成string類型 "analyzer": "english" # 把符合模式的字段的分詞器設置成english(排除頻繁詞) } }} ] }}} ~~~ ~~~ PUT /my_index/my_type/1 { "title": "this is my first article" } ~~~ ~~~ PUT /my_index/my_type/2 { "title_en": "this is my first article" } ~~~ ~~~ title沒有匹配到任何的dynamic模板,默認就是standard分詞器,不會過濾停用詞,is會進入倒排索引,用is來搜索是可以搜索到的 title_en匹配到了dynamic模板,就是english分詞器,會過濾停用詞,is這種停用詞就會被過濾掉,用is來搜索就搜索不到了 ~~~ (3)定制自己的default mapping template(index level) ~~~ PUT /my_index { "mappings": { "_default_": { "_all": { "enabled": false } }, "blog": { "_all": { "enabled": 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>

                              哎呀哎呀视频在线观看