<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智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # fields(字段) ### fields(字段) 我們經常會因為不同的目的將同一個字段用不同的方式索引。這就相當于實現了**multi-fields**。例如,一個?**string**?類型字段可以被映射成?**text**?字段作為?**full-text**?進行搜索,同時也可以作為?**keyword**?字段用于排序和聚合: | `curl -XPUT?``'localhost:9200/my_index?pretty'`?`-H?``'Content-Type: application/json'`?`-d'` `{` `"mappings"``: {` `"my_type"``: {` `"properties"``: {` `"city"``: {` `"type"``:?``"text"``,` `"fields"``: {` `"raw"``: {?``#1` `"type"``:??``"keyword"` `}` `}` `}` `}` `}` `}` `}` `'` `curl -XPUT?``'localhost:9200/my_index/my_type/1?pretty'`?`-H?``'Content-Type: application/json'`?`-d'` `{` `"city"``:?``"New York"` `}` `'` `curl -XPUT?``'localhost:9200/my_index/my_type/2?pretty'`?`-H?``'Content-Type: application/json'`?`-d'` `{` `"city"``:?``"York"` `}` `'` `curl -XGET?``'localhost:9200/my_index/_search?pretty'`?`-H?``'Content-Type: application/json'`?`-d'` `{` `"query"``: {` `"match"``: {` `"city"``:?``"york"`?`#2` `}` `},` `"sort"``: {` `"city.raw"``:?``"asc"`?`#3` `},` `"aggs"``: {` `"Cities"``: {` `"terms"``: {` `"field"``:?``"city.raw"`?`#4` `}` `}` `}` `}` `'` | | 1 | **city.raw**?字段是?**city?**字段的?**keyword?**類型字段 | | 2 | **city?**字段將被當做?**full text?**進行搜索 | | 3 4 | **city.raw?**可用于排序和聚合 | 備注 **Multi_fields**?不會改變原始的?**_source?**字段。 注意 同一索引相同字段名可以設置不同的?**fields**。可以通過[**PUT mapping API**](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/indices-put-mapping.html "Put Mapping")?在已經存在的字段加入新的?**multi-fields**。 ### Multi-fields with multiple analyzers(多分析器處理多字段) **multi-fields?**的另一種使用情況是同一字段使用不同的解析方式,使其能更好的檢索。例如,我們可以用標準分析器對字段進行索引,它將文本分解為單詞,再用英文分析器將單詞分成詞根: | `curl -XPUT?``'localhost:9200/my_index?pretty'`?`-H?``'Content-Type: application/json'`?`-d'` `{` `"mappings"``: {` `"my_type"``: {` `"properties"``: {` `"text"``: {?``#1` `"type"``:?``"text"``,` `"fields"``: {` `"english"``: {?``#2` `"type"``:?????``"text"``,` `"analyzer"``:?``"english"` `}` `}` `}` `}` `}` `}` `}` `'` `curl -XPUT?``'localhost:9200/my_index/my_type/1?pretty'`?`-H?``'Content-Type: application/json'`?`-d'` `{?``"text"``:?``"quick brown fox"`?`}?``#3` `'` `curl -XPUT?``'localhost:9200/my_index/my_type/2?pretty'`?`-H?``'Content-Type: application/json'`?`-d'` `{?``"text"``:?``"quick brown foxes"`?`}?``#4` `'` `curl -XGET?``'localhost:9200/my_index/_search?pretty'`?`-H?``'Content-Type: application/json'`?`-d'` `{` `"query"``: {` `"multi_match"``: {` `"query"``:?``"quick brown foxes"``,` `"fields"``: [?``#5` `"text"``,` `"text.english"` `],` `"type"``:?``"most_fields"`?`#6` `}` `}` `}` `'` | | 1 | **text**?字段使用標準分析器。 | | 2 | **text.english**?字段使用英文分析器。 | | 3 4 | 同時索引兩個文檔,一個使用?**fox**,另一個使用?**foxes。** | | 5 6 | 同時搜索?**text?**和?**text.english?**字段,并合并其評分。 | **text**?字段在第一個文檔中包含詞根?**fox**,在第二個文檔中包含詞根?**foxes**。**text.english?**字段在兩個文檔同時包含詞根?**fox**,因為?**foxes?**是?**fox?**的衍生詞。 字符串搜索會為?**text?**字段使用標準分析器解析,為?**text.english**?字段使用英文分析器解析。衍生字段將會使搜索?**foxes?**的同時匹配到?**fox**。這使我們能盡可能多的匹配到文檔。同時,搜索沒有衍生的?**text?**字段時,我們會在文檔精確匹配?**foxes**?的時候提高其檢索評分。
                  <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>

                              哎呀哎呀视频在线观看