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

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # Coerce(強制類型轉換) 原文鏈接 :[https://www.elastic.co/guide/en/elasticsearch/reference/5.3/coerce.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/coerce.html) 譯文鏈接 : [http://www.apache.wiki/pages/createpage-entervariables.action?templateId=4816898&spaceKey=Elasticsearch&title=&newSpaceKey=Elasticsearch&fromPageId=9406602](http://www.apache.wiki/pages/createpage-entervariables.action?templateId=4816898&spaceKey=Elasticsearch&title=&newSpaceKey=Elasticsearch&fromPageId=9406602) 貢獻者 : [程威](/display/~chengwei),[ApacheCN](/display/~apachecn),[Apache中文網](/display/~apachechina) 數據不總是干凈的.根據它的生成方式,一個數字可能會在?**`JSON body?`**中呈現為一個真正的?**JSON?**數字。例如5,但它也可能呈現為字符串,例如?**"5"?**。或者,應該是整型的數字被替代地呈現為浮點型.例如,?**5.0?**或者 **"5.0"**. **`Coercion`** 嘗試著清理臟數據讓字段符合相應的數據類型.例如 : * 字符串被強制轉換為數字. * 浮點型被截斷為整型. 例如 **:** ``` curl -XPUT 'localhost:9200/my_index?pretty' -H 'Content-Type: application/json' -d' { "mappings": { "my_type": { "properties": { "number_one": { "type": "integer" }, "number_two": { "type": "integer", "coerce": false } } } } } ' curl -XPUT 'localhost:9200/my_index/my_type/1?pretty' -H 'Content-Type: application/json' -d' { "number_one": "10" (1) } ' curl -XPUT 'localhost:9200/my_index/my_type/2?pretty' -H 'Content-Type: application/json' -d' { "number_two": "10" (2) } ' ``` | 1 | `number_one`?字段會包含整型?`10`. | | 2 | `document`(文檔)會拒絕因為`coercion`是關閉的. | Tip **coerce**?配置允許在相同的索引中具有相同名稱的字段有不同的配置.可以通過[PUT mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/indices-put-mapping.html)來更新已存在字段上的?**coerce**?值. ## Index-level default(索引級別的默認參數) **`index.mapping.coerce`** 配置可以在?**index level**(索引級別)來設置,以便在所有的 **`Mapping Types`**?全局關閉 **`coercion` **`配置`. ``` curl -XPUT 'localhost:9200/my_index?pretty' -H 'Content-Type: application/json' -d' { "settings": { "index.mapping.coerce": false }, "mappings": { "my_type": { "properties": { "number_one": { "type": "integer", "coerce": true }, "number_two": { "type": "integer" } } } } } ' curl -XPUT 'localhost:9200/my_index/my_type/1?pretty' -H 'Content-Type: application/json' -d' { "number_one": "10" }(1) ' curl -XPUT 'localhost:9200/my_index/my_type/2?pretty' -H 'Content-Type: application/json' -d' { "number_two": "10" }(2) ' ``` | 1 | **`number_one`**?字段覆蓋了 **index level**(索引級別)的設置并開啟了?**`coercion`**. | | 2 | **`document`**(文檔)會拒絕請求,因為?**`number_two`**?字段繼承了?**`index-level(索引級別)` `coercion`**的設置. |
                  <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>

                              哎呀哎呀视频在线观看