<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國際加速解決方案。 廣告
                # Nested # 嵌套數據類型 `nested?`類型是一種對象類型的特殊版本,它允許索引對象數組,獨立地索引每個對象。 ## 如何使對象數組變扁平 內部類對象數組并不以你預料的方式工作。Lucene沒有內部對象的概念,所以Elasticsearch將對象層次扁平化,轉化成字段名字和值構成的簡單列表。比如,以下的文檔: | `curl -XPUT?``'localhost:9200/my_index/my_type/1?pretty'`?`-d'` `{` `"group"`?`:?``"fans"``,` `"user"`?`: [????``// 1` `{` `"first"`?`:?``"John"``,` `"last"`?`:??``"Smith"` `},` `{` `"first"`?`:?``"Alice"``,` `"last"`?`:??``"White"` `}` `]` `}'` | `user?`字段作為對象動態添加 在內部被轉化成如下格式的文檔: | `{` `"group"`?`:????????``"fans"``,` `"user.first"`?`: [?``"alice"``,?``"john"`?`],` `"user.last"`?`:? [?``"smith"``,?``"white"`?`]` `}` | `user.first?`和?`user.last?`扁平化為多值字段,`alice?`和?`white?`的關聯關系丟失了。導致這個文檔錯誤地匹配對?`alice?`和?`smith?`的查詢: | `curl -XGET?``'localhost:9200/my_index/_search?pretty'`?`-d'` `{` `"query"``: {` `"bool"``: {` `"must"``: [` `{?``"match"``: {?``"user.first"``:?``"Alice"`?`}},` `{?``"match"``: {?``"user.last"``:??``"Smith"`?`}}` `]` `}` `}` `}'` | ## 使用`nested`字段對應`object`數組 如果你需要索引對象數組,并且保持數組中每個對象的獨立性,你應該使用`nested`對象類型而不是`object`類型。`nested`對象將數組中每個對象作為獨立隱藏文檔來索引,這意味著每個嵌套對象都可以獨立被搜索: | `curl -XPUT?``'localhost:9200/my_index?pretty'`?`-d'` `{` `"mappings"``: {` `"my_type"``: {` `"properties"``: {` `"user"``: {` `"type"``:?``"nested"`??`// 1` `}` `}` `}` `}` `}'` `curl -XPUT?``'localhost:9200/my_index/my_type/1?pretty'`?`-d'` `{` `"group"`?`:?``"fans"``,` `"user"`?`: [` `{` `"first"`?`:?``"John"``,` `"last"`?`:??``"Smith"` `},` `{` `"first"`?`:?``"Alice"``,` `"last"`?`:??``"White"` `}` `]` `}'` `curl -XGET?``'localhost:9200/my_index/_search?pretty'`?`-d'` `{` `"query"``: {` `"nested"``: {` `"path"``:?``"user"``,` `"query"``: {` `"bool"``: {` `"must"``: [` `{?``"match"``: {?``"user.first"``:?``"Alice"`?`}},` `{?``"match"``: {?``"user.last"``:??``"Smith"`?`}}???``// 2` `]` `}` `}` `}` `}` `}'` `curl -XGET?``'localhost:9200/my_index/_search?pretty'`?`-d'` `{` `"query"``: {` `"nested"``: {` `"path"``:?``"user"``,` `"query"``: {` `"bool"``: {` `"must"``: [` `{?``"match"``: {?``"user.first"``:?``"Alice"`?`}},` `{?``"match"``: {?``"user.last"``:??``"White"`?`}}???``// 3` `]` `}` `},` `"inner_hits"``: {???``// 4` `"highlight"``: {` `"fields"``: {` `"user.first"``: {}` `}` `}` `}` `}` `}` `}'` | | 1 | `user?`字段映射為?`nested?`類型而不是?`objec t`類型 | | 2 | 該查詢沒有匹配,因為?`Alice?`和?`Smith?`不在同一個嵌套類中 | | 3 | 該查詢有匹配,因為?`Alice?`和?`White?`在同一個嵌套類中 | | 4 | `inner_hits?`可以高亮匹配的嵌套文檔 | 嵌套文檔可以: | 1 | `使用?`[nested](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-nested-query.html "Nested Query")?``<span style="color: rgb(36, 41, 46);">查詢來搜索</span> | | 2 | 使用?`[nested](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-nested-aggregation.html "Nested Aggregation")?`<span style="color: rgb(36, 41, 46);">和?[`reverse_nested`](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-reverse-nested-aggregation.html "Reverse nested Aggregation")</span><span style="color: rgb(36, 41, 46);">聚合來分析</span> | | 3 | 使用?[nested sorting](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-sort.html#nested-sorting "Sorting within nested objects.")<span style="color: rgb(36, 41, 46);">來排序</span> | | 4 | 使用?[nested inner hits](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-inner-hits.html#nested-inner-hits "Nested inner hits")?<span style="color: rgb(36, 41, 46);">來檢索和高亮</span> | </div> </div> </div> </div> <div class="columnLayout single" data-layout="single" style="margin: 0px 0px 8px; padding: 0px; display: table; table-layout: fixed; width: 548px;"> <div class="cell normal" data-type="normal" style="margin: 8px 0px; padding: 0px 15px; box-sizing: border-box; word-wrap: break-word; border-radius: 5px; display: table-cell; vertical-align: top;"> <div class="innerCell" style="margin: 0px; padding: 0px; overflow-x: auto;"> ## `nested?`字段參數 <div class="table-wrap" style="margin: 10px 0px 0px; padding: 0px; overflow-x: auto;"> | <span style="color: rgb(36, 41, 46);">參數</span> | <span style="color: rgb(36, 41, 46);">說明</span> | | <span style="color: rgb(36, 41, 46);">dynamic</span> | <span style="color: rgb(36, 41, 46);">新屬性是否應動態添加到現有對象。接受 true (默認), false 和 strict。</span> | | <span style="color: rgb(36, 41, 46);">include_in_all</span> | <span style="color: rgb(36, 41, 46);">為對象中的所有屬性設置默認的?</span>`include_in_all?`<span style="color: rgb(36, 41, 46);">值,對象本身沒有添加到 _all 字段。</span> | | <span style="color: rgb(36, 41, 46);">properties</span> | <span style="color: rgb(36, 41, 46);">對象內的字段,可以是任何數據類型,包括對象。可以將新屬性添加到現有對象。</span> | </div> <div class="confluence-information-macro confluence-information-macro-information conf-macro output-block" data-hasbody="true" data-macro-name="info" style="margin: 10px 0px 1em; padding: 10px 10px 10px 36px; border: 1px solid rgb(170, 184, 198); border-radius: 5px; min-height: 20px; position: relative; background: rgb(252, 252, 252);"> 注意 <span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon" style="border: none; display: block; height: 16px; margin: 0px; padding: 0px; text-indent: -999em; vertical-align: text-bottom; width: 16px; line-height: 20px; position: absolute; left: 10px; top: 12px; color: rgb(74, 103, 133); background-position: 0px 0px; background-repeat: no-repeat;"></span> <div class="confluence-information-macro-body" style="margin: 0px; padding: 0px;"> <span style="color: rgb(106, 115, 125);">因為嵌套文檔是作為單獨的文檔被索引的,所以嵌套文檔只能被?</span>`nested?`<span style="color: rgb(106, 115, 125);">查詢、</span>`nested / reverse_nested`<span style="color: rgb(106, 115, 125);">或者?</span>`nested inner hits?`<span style="color: rgb(106, 115, 125);">訪問。 比如,一個</span>`string?`<span style="color: rgb(106, 115, 125);">字段包含嵌套文檔,嵌套文檔中?</span>`index_options?`<span style="color: rgb(106, 115, 125);">設置為?</span>`offsets?`<span style="color: rgb(106, 115, 125);">以使用 postings highlighter,這些偏移量在主要的高亮階段是不可用的。必須通過?</span>`nested inner hits?`<span style="color: rgb(106, 115, 125);">來進行高亮操作。</span> </div> </div> </div> </div> </div> </div> ## 限制`nested`字段的數量 <div style="margin: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Arial, sans-serif; line-height: 20px; widows: 1;"> <div style="margin: 0px; padding: 0px;"> <div style="margin: 0px; padding: 0px;"> <div class="container new-discussion-timeline experiment-repo-nav" style="margin: 0px 0px 0px auto; padding: 0px;"> <div class="repository-content" style="margin: 0px; padding: 0px;"> <div class="file" style="margin: 0px; padding: 0px;"> <div class="readme blob instapaper_body" style="margin: 0px; padding: 0px;"> 索引一個包含 100 個?`nested?`字段的文檔實際上就是索引 101 個文檔,每個嵌套文檔都作為一個獨立文檔來索引。為了防止過度定義嵌套字段的數量,每個索引可以定義的嵌套字段被限制在 50 個。
                  <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>

                              哎呀哎呀视频在线观看