<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國際加速解決方案。 廣告
                # dynamic(動態設置) 原文鏈接 : [https://www.elastic.co/guide/en/elasticsearch/reference/5.3/dynamic.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/dynamic.html) 譯文鏈接 : [http://www.apache.wiki/pages/createpage-entervariables.action?templateId=4816898&spaceKey=Elasticsearch&title=&newSpaceKey=Elasticsearch&fromPageId=9405287](http://www.apache.wiki/pages/createpage-entervariables.action?templateId=4816898&spaceKey=Elasticsearch&title=&newSpaceKey=Elasticsearch&fromPageId=9405287) 貢獻者 : @您的名字,[ApacheCN](/display/~apachecn),[Apache中文網](/display/~apachechina) ## 默認情況下,字段會動態的添加到?**document** 或者?**document?**的?[inner objects](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/object.html "Object datatype")(內部對象),只需要通過索引包含這個新字段的?**document。**例如: ``` curl -XPUT 'localhost:9200/my_index/my_type/1?pretty' -H 'Content-Type: application/json' -d' # 1 { "username": "johnsmith", "name": { "first": "John", "last": "Smith" } } ' curl -XGET 'localhost:9200/my_index/_mapping?pretty' # 2 curl -XPUT 'localhost:9200/my_index/my_type/2?pretty' -H 'Content-Type: application/json' -d' # 3 { "username": "marywhite", "email": "mary@white.com", "name": { "first": "Mary", "middle": "Alice", "last": "White" } } ' curl -XGET 'localhost:9200/my_index/_mapping?pretty' # 4 ``` | 1 | 這個文檔介紹了字符串字段 **username ,**對象字段name,和兩個在 **name** 對象下的字符串字段 ,可以稱為 **name.first** 和 **name.last**。 | | 2 | 檢查映射來驗證上面的 **PUT**。 | | 3 | 這個文檔添加兩個字符串字段 **email** 和 **name.middle**。 | | 4 | 檢查映射來驗證上面的改動. | 新字段如何被檢測和添加到映射的細節可以見??**[_Dynamic Mapping_](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/dynamic-mapping.html "Dynamic Mapping").** **dynamic** 設置控制著新的字段是否可以動態的添加.有三個配置參數: | **true** | 新檢測的字段被添加到映射中.(默認配置) | | **false** | 新檢測的字段將被忽略。 必須明確添加新字段。 | | **strict** | 如果檢測到新字段,將拋出異常并且文檔是拒絕的。 | dynamic 可以在映射類型級別和每個[inner object](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/object.html "Object datatype")(內部對象)進行設置。 inner object(內部對象)繼承其父對象和來自于映射類型的設置. 例如 : ``` curl -XPUT 'localhost:9200/my_index?pretty' -H 'Content-Type: application/json' -d' { "mappings": { "my_type": { "dynamic": false, # 1 "properties": { "user": { # 2 "properties": { "name": { "type": "text" }, "social_networks": { # 3 "dynamic": true, "properties": {} } } } } } } } ' ``` | 1 | **dynamic mapping**(動態映射)在類型級別被禁用,所以不會有新的頂級字段動態添加. | | 2 | **user** 對象繼承類型級別設置. | | 3 | **user.social_networks** 對象允許動態映射,因此可以將新字段添加到該 **inner object** (內部對象)。 | 建議 **dynamic** 設置允許在同一索引中相同名稱的字段的有不同設置。 可以使用?[PUT mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/indices-put-mapping.html "Put Mapping")(PUT映射API)在現有字段上更新字段的值。
                  <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>

                              哎呀哎呀视频在线观看