elasticsearch - simple_query_string 搜索中的多个单词短语不返回突出显示数据,但会返回任何非零斜率
问题描述
使用 simple_query_string 和任何荧光笔(普通、统一、fvh)时,我会出现一种特殊的高亮行为
简单查询字符串使用术语(不是短语) 时工作的亮点:仅使用术语时工作
当您关闭引用时,亮点停止工作,有效地使定期会议成为一个短语: 作为短语搜索时根本不起作用
但是,如果我在以前不工作的短语中添加任何超过 0 的 slop,它会再次正常工作,尽管结果集错误,因为我不想要 slopped 结果: 如果我 slop 但是效果很好
当使用直接 API 请求时,当搜索具有零斜率(或斜率未定义)的短语时,突出显示键在结果中完全消失,导致上述第二步中的行为。
我也尝试过覆盖突出显示查询,同样的问题。这是我在这些示例中使用的查询,我还使用硬编码字符串和 API 调用直接复制了这种行为:
"query": {
"simple_query_string": {
"query": query,
"fields": ["title", "content"]
}
},
"highlight": {
"fields": {
"title": {},
"content": {}
}
}
突出显示的相关字段(标题、内容)具有如下映射:
"properties" : {
"content" : {
"type" : "text",
"fields" : {
"autosuggest" : {
"type" : "text",
"analyzer" : "autosuggest_analyzer",
"search_analyzer" : "ngram_search_analyzer"
},
"delimiter" : {
"type" : "text",
"index_options" : "offsets",
"analyzer" : "universal_delimiter_analyzer"
},
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
},
"lang" : {
"type" : "text",
"analyzer" : "universal"
},
"synonyms" : {
"type" : "text",
"analyzer" : "synonyms"
}
},
"analyzer" : "standard",
"index_prefixes" : {
"min_chars" : 1,
"max_chars" : 12
},
"index_phrases" : true
},
"title" : {
"type" : "text",
"fields" : {
"autosuggest" : {
"type" : "text",
"analyzer" : "autosuggest_analyzer",
"search_analyzer" : "ngram_search_analyzer"
},
"delimiter" : {
"type" : "text",
"index_options" : "offsets",
"analyzer" : "universal_delimiter_analyzer"
},
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
},
"lang" : {
"type" : "text",
"analyzer" : "universal"
},
"synonyms" : {
"type" : "text",
"analyzer" : "synonyms"
}
},
"analyzer" : "standard",
"index_prefixes" : {
"min_chars" : 1,
"max_chars" : 12
},
"index_phrases" : true
},
...
最后,这是版本信息:
"version" : {
"number" : "7.9.0",
"build_flavor" : "oss",
"build_type" : "rpm",
"build_hash" : "a479a2a7fce0389512d6a9361301708b92dff667",
"build_date" : "2020-08-11T21:36:48.204330Z",
"build_snapshot" : false,
"lucene_version" : "8.6.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
有没有人遇到过这个?我在这里遗漏了什么明显的东西吗?这很令人困惑,因为它可以很好地与 slop 配合使用,但否则甚至不会在结果中返回突出显示条目。到目前为止,我所见过的任何其他问题/解决方案似乎都与此问题无关。
解决方案
推荐阅读
- android - com.google.android.gms:play-services-measurement-base 正在被其他各种库请求
- pascal - Pascal 基本读写文件处理
- python - Beautiful Soup 的编码错误:字符映射到未定义(Python)
- trace32 - 设备中出现trace32“访问超时,目标正在运行”错误
- python - 我有一个 python 程序,但是如何将数据显示到基于 NodeJS 的 Web 应用程序上?
- postscript - 在 Postscript 中的文本周围使用“缓冲区”进行剪辑
- python - 如何绘制 seaborn 或 matlab 图
- python - 提取跟随变化的时间字符串的字符串
- azure - 如何在 Azure CosmosDB 中编写 LIKE 查询?
- c++ - 分段错误已解决,但无法弄清楚原因