将 Elasticsearch 配置为不突出显示停用词
Configure Elasticsearch to not highlight stopwords
是否可以将 Elasticsearch 配置为不突出显示文本中单独出现的停用词?
例如,在维基百科的以下文本中,我想突出显示 "the lord of the rings"、"rings" 或 "lord",但我不希望 Elasticsearch 突出显示 "of" 或 "the" 如果它们单独出现。
The Lord of the Rings is an epic high-fantasy novel written by English author J. R. R. Tolkien. The story began as a sequel to Tolkien's 1937 fantasy novel The Hobbit, but eventually developed into a much larger work. Written in stages between 1937 and 1949, The Lord of the Rings is one of the best-selling novels ever written, with over 150 million copies sold. The title of the novel refers to the story's main antagonist, the Dark Lord Sauron, who had in an earlier age created the One Ring to rule the other Rings of Power as the ultimate weapon ...
您正在寻找highlight_query:
- 使用_analyze分析指环王得到没有stopwords
的单词
- 使用
highlight_query
搜索 指环王 并且没有来自 1. 的停用词
可能喜欢:
GET /_search
{
"query" : {
"match": {
"my_field": {
"query": "The Lord of the Rings"
}
}
},
"highlight" : {
"order" : "score",
"fields" : {
"my_field" : {
"highlight_query": {
"bool": {
"should": {
"match_phrase": {
"content": {
"query": "my words"
}
}
}
}
}
}
}
}
}
是否可以将 Elasticsearch 配置为不突出显示文本中单独出现的停用词?
例如,在维基百科的以下文本中,我想突出显示 "the lord of the rings"、"rings" 或 "lord",但我不希望 Elasticsearch 突出显示 "of" 或 "the" 如果它们单独出现。
The Lord of the Rings is an epic high-fantasy novel written by English author J. R. R. Tolkien. The story began as a sequel to Tolkien's 1937 fantasy novel The Hobbit, but eventually developed into a much larger work. Written in stages between 1937 and 1949, The Lord of the Rings is one of the best-selling novels ever written, with over 150 million copies sold. The title of the novel refers to the story's main antagonist, the Dark Lord Sauron, who had in an earlier age created the One Ring to rule the other Rings of Power as the ultimate weapon ...
您正在寻找highlight_query:
- 使用_analyze分析指环王得到没有stopwords 的单词
- 使用
highlight_query
搜索 指环王 并且没有来自 1. 的停用词
可能喜欢:
GET /_search
{
"query" : {
"match": {
"my_field": {
"query": "The Lord of the Rings"
}
}
},
"highlight" : {
"order" : "score",
"fields" : {
"my_field" : {
"highlight_query": {
"bool": {
"should": {
"match_phrase": {
"content": {
"query": "my words"
}
}
}
}
}
}
}
}
}