![](/img/trans.png)
[英]ElasticSearch and highlighting performance - plain vs. fast vector highlighter
[英]Plain Highlighter “order”:“none” is not working in Elasticsearch
我在test_plain_highlighter索引下创建了。 我希望突出显示的片段应该按照它们出现在使用普通荧光笔的字段中的顺序出现。
我尝试过以下选项,
但是,它总是给出基于 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 代码库中存在由他们的团队成员确认的错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.