elasticsearch - Elasticsearch 快速矢量荧光笔 (FVH) 不返回“高亮”对象字段
问题描述
以下查询——
GET /<my-index>/_search?pretty
{
"query": {
"bool": {
"should": [
{
"query_string": {
"query": "blah blah*"
}
}
],
"must": {
"bool": {
"should": [
{
"match": {
"<some-category>": "foo"
}
}
]
}
}
}
},
"highlight": {
"pre_tags": [
""
],
"post_tags": [
""
],
"fields": {
"*": {
"type": "plain"
}
}
},
"_source": false,
"size": 200
}
返回以下结构的对象——
{
"took" : 2570,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 6086,
"relation" : "eq"
},
"max_score" : 19.051311,
"hits" : [
{
"_index" : "quotient_aod",
"_type" : "_doc",
"_id" : "YCYekXoBP0GFKIFvzFYe",
"_score" : 19.051311,
"highlight" : {
"product_desc" : [
"..."
],...
}
},...
...
}
注意highlight
属性的存在。以下查询的响应中缺少该属性-
GET /<my-index>/_search?pretty
{
"query": {
"bool": {
"should": [
{
"query_string": {
"query": "blah blah*"
}
}
],
"must": {
"bool": {
"should": [
{
"match": {
"<some-category>": "foo"
}
}
]
}
}
}
},
"highlight": {
"pre_tags": [
""
],
"post_tags": [
""
],
"fields": {
"*": {
"type": "fvh"
}
}
},
"_source": false,
"size": 200
}
回复:
{
"took" : 184,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 6086,
"relation" : "eq"
},
"max_score" : 19.051311,
"hits" : [
{
"_index" : "quotient_aod",
"_type" : "_doc",
"_id" : "YCYekXoBP0GFKIFvzFYe",
"_score" : 19.051311
},...
...
}
请注意,在plain
和fvh
请求中的命中是相同的。ids(YCYekXoBP0GFKIFvzFYe
在本例中是第一个)在两个响应中对应。但是,正如我所说,荧光笔请求highlight
的响应中缺少 object 属性。fvh
这是为什么?
解决方案
推荐阅读
- php - 将两个模型合并到一个数据库调用中 - laravel
- javascript - 使用 fetch 的老兄
- python - 将 3D 数组重塑为 2D 数组 Python
- javascript - 数组总是在每个元素中获取最后一个值
- python - 调试 Python Flask 应用程序时,断点未在 VS Code 中命中
- android - 为浮动操作按钮实现阴影
- c# - 使用 ac# 函数加速查询交叉应用
- javascript - 错误:“请求失败,状态码 500” con laravel en axios.put()
- bash - 脚本更改方式代码功能的命令行参数
- ansible - Ansible EC2 动态清单的问题