-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discover is not highlighting text in arrays of objects #53840
Comments
Pinging @elastic/kibana-app (Team:KibanaApp) |
Hey @fdartayre, I started to look into this issue and found that the formatter requires a So in the case of {
"field_a.field_b": "random string"
} Which is fine because In the case of {
"field_a": [
{
"field_b": "random string"
}
]
} But this time it tries to look for the field Even if it could find the field, the highlight payload doesn't say which index in the array the highlighted value is in. I think the only approach for this would be to use a GET test_index/_search
{
"query": {
"nested": {
"path": "field_a",
"query": {
"bool": {
"filter": [
{
"multi_match": {
"type": "best_fields",
"query": "string",
"lenient": true
}
}
]
}
},
"inner_hits": {
"highlight": {
"fields": {
"*": {}
}
}
}
}
}
} Which would result in a response like below which would give you the information needed to highlight the nested fields, namely {
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 2,
"relation" : "eq"
},
"max_score" : 0.0,
"hits" : [
{
"_index" : "test_index",
"_id" : "1",
"_score" : 0.0,
"_source" : {
"field_a" : {
"field_b" : "random string"
}
},
"inner_hits" : {
"field_a" : {
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 0.0,
"hits" : [
{
"_index" : "test_index",
"_id" : "1",
"_nested" : {
"field" : "field_a",
"offset" : 0
},
"_score" : 0.0,
"_source" : {
"field_b" : "random string"
},
"highlight" : {
"field_a.field_b" : [
"random <em>string</em>"
]
}
}
]
}
}
}
},
{
"_index" : "test_index",
"_id" : "2",
"_score" : 0.0,
"_source" : {
"field_a" : [
{
"field_b" : "random string"
}
]
},
"inner_hits" : {
"field_a" : {
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 0.0,
"hits" : [
{
"_index" : "test_index",
"_id" : "2",
"_nested" : {
"field" : "field_a",
"offset" : 0
},
"_score" : 0.0,
"_source" : {
"field_b" : "random string"
},
"highlight" : {
"field_a.field_b" : [
"random <em>string</em>"
]
}
}
]
}
}
}
}
]
}
} All that said, it seems to me that there was never support for the nested field highlighting but I can certainly be wrong. I am checking with the team to be sure but wanted to ask if you know of an older version of kibana that supported this functionality? |
Hi, I am seeing the same issue. The fact that the discover tab doesn't correctly recognize fields of sub-objects wrapped in arrays is clearly a bug itself (the highlighting issue is just one problem that arises as a result, but this is not the root cause nor the only issue). Other problems e.g. are that you cannot use the "filter for value" button on affected fields. See also this thread. I think this bug needs to be looked into, but not in the context of highlighting search results. In general, the suggestion of using a nested mapping is not a solution. |
Pinging @elastic/kibana-app-services (Team:AppServices) |
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
related to #3735 |
Kibana version: 7.5.0
Describe the bug:
Kibana is not highlighting matches when the text field is inside an array of objets.
Steps to reproduce:
The "string" text should also be highlighted in the second document.
Expected behavior:
Here's the response from Elasticsearch to the
_msearch
request sent by Kibana:Elasticsearch is correctly highlighting "string" and Kibana should be showing it in Discover.
The text was updated successfully, but these errors were encountered: