<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國際加速解決方案。 廣告
                1. 一個最基本的高亮例子 ~~~ PUT /blog_website { "mappings": { "blogs": { "properties": { "title": { "type": "text", "analyzer": "ik_max_word" }, "content": { "type": "text", "analyzer": "ik_max_word" } } } } } ~~~ ~~~ PUT /blog_website/blogs/1 { "title": "我的第一篇博客", "content": "大家好,這是我寫的第一篇博客,特別喜歡這個博客網站!!!" } GET /blog_website/blogs/_search { "query": { "match": { "title": "博客" } }, "highlight": { "fields": { "title": {} } } } ~~~ ~~~ { "took": 103, "timed_out": false, "_shards": { "total": 5, "successful": 5, "failed": 0 }, "hits": { "total": 1, "max_score": 0.28582606, "hits": [ { "_index": "blog_website", "_type": "blogs", "_id": "1", "_score": 0.28582606, "_source": { "title": "我的第一篇博客", "content": "大家好,這是我寫的第一篇博客,特別喜歡這個博客網站!!!" }, "highlight": { "title": [ "我的第一篇<em>博客</em>" ] } } ] } } ~~~ <em></em>表現,會變成紅色,所以說你的指定的field中,如果包含了那個搜索詞的話,就會在那個field的文本中,對搜索詞進行紅色的高亮顯示 ~~~ GET /blog_website/blogs/_search { "query": { "bool": { "should": [ { "match": { "title": "博客" } }, { "match": { "content": "博客" } } ] } }, "highlight": { "fields": { "title": {}, "content": {} } } } ~~~ highlight中的field,必須跟query中的field一一對齊的 2. 三種highlight介紹 plain highlight,lucene highlight,默認 posting highlight,index_options=offsets (1)性能比plain highlight要高,因為不需要重新對高亮文本進行分詞 (2)對磁盤的消耗更少 (3)將文本切割為句子,并且對句子進行高亮,效果更好 ~~~ PUT /blog_website { "mappings": { "blogs": { "properties": { "title": { "type": "text", "analyzer": "ik_max_word" }, "content": { "type": "text", "analyzer": "ik_max_word", "index_options": "offsets" } } } } } ~~~ PUT /blog_website/blogs/1 { "title": "我的第一篇博客", "content": "大家好,這是我寫的第一篇博客,特別喜歡這個博客網站!!!" } ~~~ GET /blog_website/blogs/_search { "query": { "match": { "content": "博客" } }, "highlight": { "fields": { "content": {} } } } ~~~ fast vector highlight index-time term vector設置在mapping中,就會用fast verctor highlight (1)對大field而言(大于1mb),性能更高 ~~~ PUT /blog_website { "mappings": { "blogs": { "properties": { "title": { "type": "text", "analyzer": "ik_max_word" }, "content": { "type": "text", "analyzer": "ik_max_word", "term_vector" : "with_positions_offsets" } } } } } ~~~ 強制使用某種highlighter,比如對于開啟了term vector的field而言,可以強制使用plain highlight ~~~ GET /blog_website/blogs/_search { "query": { "match": { "content": "博客" } }, "highlight": { "fields": { "content": { "type": "plain" } } } } ~~~ 總結一下,其實可以根據你的實際情況去考慮,一般情況下,用plain highlight也就足夠了,不需要做其他額外的設置 如果對高亮的性能要求很高,可以嘗試啟用posting highlight 如果field的值特別大,超過了1M,那么可以用fast vector highlight 3. 設置高亮html標簽,默認是<em>標簽 ~~~ GET /blog_website/blogs/_search { "query": { "match": { "content": "博客" } }, "highlight": { "pre_tags": ["<tag1>"], "post_tags": ["</tag2>"], "fields": { "content": { "type": "plain" } } } } ~~~ 4. 高亮片段fragment的設置 ~~~ GET /_search { "query" : { "match": { "user": "kimchy" } }, "highlight" : { "fields" : { "content" : {"fragment_size" : 150, "number_of_fragments" : 3, "no_match_size": 150 } } } } ~~~ > fragment_size: > 你一個Field的值,比如有長度是1萬,但是你不可能在頁面上顯示這么長啊。。。設置要顯示出來的fragment文本判斷的長度,默認是100(highlight部分顯示最大長度) > number_of_fragments: > 你可能你的高亮的fragment文本片段有多個片段,你可以指定就顯示幾個片段(高亮部分顯示幾個) "no_match_size": 150:
                  <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>

                              哎呀哎呀视频在线观看