簡體   English   中英

普通熒光筆“訂單”:“無”在 Elasticsearch 中不起作用

[英]Plain Highlighter “order”:“none” is not working in Elasticsearch

我在test_plain_highlighter索引下創建了。 我希望突出顯示的片段應該按照它們出現在使用普通熒光筆的字段中的順序出現。

我嘗試過以下選項,

  • 在高亮查詢中設置“order”:“none” (如下查詢所示)。
  • 高亮查詢中沒有定義順序
  • 在高亮查詢中設置“order”:“score”

但是,它總是給出基於 SCORE 排序的突出顯示的片段。 我希望它們在字段中出現時按順序排列。 請幫幫我。

命令

當設置為score時,按 score 對突出顯示的片段進行排序。 默認情況下,片段將按照它們在字段中出現的順序為 output(順序: none )。 將此選項設置為score將首先 output 最相關的片段。 每個熒光筆都應用自己的邏輯來計算相關性分數。 有關不同熒光筆如何找到最佳片段的更多詳細信息,請參閱文檔熒光筆內部工作原理

PUT test_plain_highlighter 
{}

POST /test_plain_highlighter/_doc/1
{
  "description" : "Lorem Ipsum string Generator that helps to create dummy text for all layout needs. In publishing and graphic design, Lorem ipsum is a placeholder text commonly used to Apple's Pages and Keynote software employs such jumbled text as sample screenplay layout. search facial Lorem ipsum is also featured on Joomla. Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it search string over 2000 years old."
}

要求

POST /test_plain_highlighter/_search
{
  "highlight": {
    "order": "none",
    "type": "plain",
    "fields": {
      "*": {}
    },
    "fragment_size": 50
  },
  "query": {
    "match": {
      "description": "search string"
    }
  },
  "_source": ""
}

回復

{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 1,
      "relation" : "eq"
    },
    "max_score" : 0.79659015,
    "hits" : [
      {
        "_index" : "test_plain_highlighter",
        "_type" : "_doc",
        "_id" : "1",
        "_score" : 0.79659015,
        "_source" : { },
        "highlight" : {
          "description" : [
            ", making it <em>search</em> <em>string</em> over 2000 years old.",
            "Lorem Ipsum <em>string</em> Generator that helps to create",
            " layout. <em>search</em> facial Lorem ipsum is also"
          ]
        }
      }
    ]
  }
}

收到突出顯示的片段:

[
", making it `<em>search</em>` `<em>string</em>` over 2000 years old.",
"Lorem Ipsum `<em>string</em>` Generator that helps to create",
" layout. `<em>search</em>` facial Lorem ipsum is also"
]

預期突出顯示的片段:

[
"Lorem Ipsum `<em>string</em>` Generator that helps to create",
" layout. `<em>search</em>` facial Lorem ipsum is also",
", making it `<em>search</em>` `<em>string</em>` over 2000 years old."
]

Elasticsearch 代碼庫中存在由他們的團隊成員確認的錯誤。

https://github.com/elastic/elasticsearch/issues/58236

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM