作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我很难理解下面的查询对象为什么不能使ES突出显示_source列中的所有单词。
{
_source: [
'baseline',
'cdrp',
'date',
'description',
'dev_status',
'element',
'event',
'id'
],
track_total_hits: true,
query: {
bool: {
filter: [],
should: [
{
multi_match:{
query: "imposed calcs",
fields: ["cdrp","description","narrative.*","title","cop"]
}
}
]
}
},
highlight: { fields: { '*': {} } },
sort: [],
from: 0,
size: 50
}
"highlight": {
"description": [
"GAP Sub-window conn ONe-e: heve PP-BE Defined ASST requirem RV confsng, des MAN Imposed <em>calcs</em> mising"
]
}
"description": {
"type": "text",
"analyzer": "search_synonyms"
},
"analysis": {
"analyzer": {
"search_synonyms": {
"tokenizer": "whitespace",
"filter": [
"graph_synonyms"
],
"normalizer": [
"normalizer_1"
]
}
},
"filter": {
"graph_synonyms": {
"type": "synonym_graph",
"synonyms_path": "synonym.txt"
}
},
"normalizer": {
"normalizer_1": {
"type": "custom",
"char_filter": [],
"filter": ["lowercase", "asciifolding"]
}
}
}
最佳答案
编辑
我认为您的graph_synonyms
过滤器覆盖了规范化器的过滤器。试试这个:
PUT highlighter
{
"settings": {
"analysis": {
"analyzer": {
"search_synonyms": {
"tokenizer": "whitespace",
"filter": [
"graph_synonyms",
"lowercase",
"asciifolding"
]
}
},
"filter": {
"graph_synonyms": {
"type": "synonym_graph",
"synonyms_path": "synonym.txt"
}
}
}
},
"mappings": {
"properties": {
"description": {
"type": "text",
"analyzer": "search_synonyms"
}
}
}
}
PUT highlighter
{
"settings": {
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "standard",
"filter": [
"lowercase"
]
}
}
}
},
"mappings": {
"properties": {
"description": {
"type": "text",
"fields": {
"lowercase": {
"type": "text",
"analyzer": "my_analyzer"
}
}
}
}
}
}
POST highlighter/_doc
{
"description": "GAP Sub-window conn ONe-e: heve PP-BE Defined ASST requirem RV confsng, des MAN Imposed calcs mising"
}
GET highlighter/_search
{
"_source": [
"baseline",
"cdrp",
"date",
"description",
"dev_status",
"element",
"event",
"id"
],
"track_total_hits": true,
"query": {
"bool": {
"filter": [],
"should": [
{
"multi_match": {
"query": "imposed calcs",
"fields": [
"cdrp",
"description.lowercase",
"narrative.*",
"title",
"cop"
]
}
}
]
}
},
"highlight": {
"fields": {
"*": {}
}
},
"sort": [],
"from": 0,
"size": 50
}
[
{
"_index":"highlighter",
"_type":"_doc",
"_id":"Bf5F5HEBW-D5QnrWwTyh",
"_score":0.5753642,
"_source":{
"description":"GAP Sub-window conn ONe-e: heve PP-BE Defined ASST requirem RV confsng, des MAN Imposed calcs mising"
},
"highlight":{
"description":[
"GAP Sub-window conn ONe-e: heve PP-BE Defined ASST requirem RV confsng, des MAN <em>Imposed</em> <em>calcs</em> mising"
]
}
}
]
关于elasticsearch - Elasticsearch未突出显示所有匹配项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61609840/
有没有一种方法可以“标记”对象的属性,使它们在反射中“突出”? 例如: class A { int aa, b; string s1, s2; public int AA
我是一名优秀的程序员,十分优秀!