Hi,
I have found a behaviour of highlight of wildcard little different.
When I search using single "" i.e., a wildcard character, It does not highlight any of the values.
But if I do the same using two or more "" i.e., wildcard character, It does highlight all the values.
Although the results fetched are the same, why is there such a difference in highlight?
example : 1. Multiple wildcards
{
"from" : 0, "size" : 10,"_source": {"includes":["ID"]
}, "query": {
"bool": {"should": [ {
"bool": {"must": [ {
"query_string": {
"query":"**",
"fields":["ID"]
}}]}}],"minimum_should_match":1}},"highlight": {
"type" : "unified",
"fragment_size" : 0,
"order":"score",
"number_of_fragments" :4,
"fields": {
"*": {
}
}
}
}
Results :
{
"_index": "index_name",
"_type": "_doc",
"_id": "AUTO",
"_score": 1,
"_source": {
"ID": "AUTO"
},
"highlight": {
"ID": [
"<em>AUTO</em>"
]
}
}
- Singular Wildcard
{
"from" : 0, "size" : 10,"_source": {"includes":["ID"]
}, "query": {
"bool": {"should": [ {
"bool": {"must": [ {
"query_string": {
"query":"",
"fields":["ID"]
}}]}}],"minimum_should_match":1}},"highlight": {
"type" : "unified",
"fragment_size" : 0,
"order":"score",
"number_of_fragments" :4,
"fields": {
"": {
}
}
}
}
Results :
{ "_index": "index_name",
"_type": "_doc",
"_id": "AUTO",
"_score": 1,
"_source": {
"ID": "AUTO"
}
}