Hi
I was able to get highlighting to work correctly with some sample queries from documentation website. However, for my real queries I am facing a strange problem where the highlight tags are displayed many times over for blank tokens. My real query is a function_score query but since we have a native Java scoring script I decided to test with just the query portion. I see the problem there as well.
Request:
POST ire-ire-customer-entity/_search
{ "query":{"query_string":{"query":"((demetrius~ AND steyer) OR (demetrius AND steyer~) OR (demetrius~ AND percy) OR (demetrius AND percy~) OR (percy~ AND steyer) OR (percy AND steyer~))","default_field":"Name","fields":,"type":"best_fields","default_operator":"or","analyzer":"analyzer_qs_Name","max_determinized_states":10000,"enable_position_increments":true,"fuzziness":"AUTO","fuzzy_prefix_length":0,"fuzzy_max_expansions":50,"phrase_slop":0,"escape":false,"auto_generate_synonyms_phrase_query":true,"fuzzy_transpositions":true,"boost":1.0}},"min_score":0.8, "_source": "Name", "highlight": {"fields": {"Name" : {"type": "plain"}}}}
Response:
{
"took": 51,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 27,
"max_score": 109.12074,
"hits": [
{
"_index": "ire-ire-customer-entity-191105050740",
"_type": "Customer",
"_id": "Occupancies:12009939.Customer[1]",
"_score": 109.12074,
"_routing": "9",
"_source": {
"Name": "Demetrius Percy Steyer"
},
"highlight": {
"Name": [
"<em></em><em></em><em></em><em></em><em></em><em></em>Demetrius Percy Steyer"
]
}
},
{
"_index": "ire-ire-customer-entity-191105050740",
"_type": "Customer",
"_id": "Occupancies:12009945.Customer[1]",
"_score": 109.12074,
"_routing": "9",
"_source": {
"Name": "Demetrius Percy Steyer"
},
"highlight": {
"Name": [
"<em></em><em></em><em></em><em></em><em></em><em></em>Demetrius Percy Steyer"
]
}
},
{
"_index": "ire-ire-customer-entity-191105050740",
"_type": "Customer",
"_id": "Occupancies:12009948.Customer[1]",
"_score": 109.12074,
"_routing": "9",
"_source": {
"Name": "Demetrius Percy Steyer"
},
"highlight": {
"Name": [
"<em></em><em></em><em></em><em></em><em></em><em></em>Demetrius Percy Steyer"
]
}
},
{
"_index": "ire-ire-customer-entity-191105050740",
"_type": "Customer",
"_id": "Occupancies:12009936.Customer[1]",
"_score": 109.12074,
"_routing": "9",
"_source": {
"Name": "Demetrius Percy Steyer"
},
"highlight": {
"Name": [
"<em></em><em></em><em></em><em></em><em></em><em></em>Demetrius Percy Steyer"
]
}
},
{
"_index": "ire-ire-customer-entity-191105050740",
"_type": "Customer",
"_id": "Occupancies:12009938.Customer[1]",
"_score": 109.12074,
"_routing": "9",
"_source": {
"Name": "Demetrius Percy Steyer"
},
"highlight": {
"Name": [
"<em></em><em></em><em></em><em></em><em></em><em></em>Demetrius Percy Steyer"
]
}
},
{
"_index": "ire-ire-customer-entity-191105050740",
"_type": "Customer",
"_id": "Occupancies:12009928.Customer[1]",
"_score": 109.12074,
"_routing": "9",
"_source": {
"Name": "Demetrius Percy Steyer"
},
"highlight": {
"Name": [
"<em></em><em></em><em></em><em></em><em></em><em></em>Demetrius Percy Steyer"
]
}
},
{
"_index": "ire-ire-customer-entity-191105050740",
"_type": "Customer",
"_id": "Occupancies:12009932.Customer[1]",
"_score": 109.12074,
"_routing": "9",
"_source": {
"Name": "Demetrius Percy Steyer"
},
"highlight": {
"Name": [
"<em></em><em></em><em></em><em></em><em></em><em></em>Demetrius Percy Steyer"
]
}
},
{
"_index": "ire-ire-customer-entity-191105050740",
"_type": "Customer",
"_id": "Occupancies:12009947.Customer[1]",
"_score": 109.12074,
"_routing": "9",
"_source": {
"Name": "Demetrius Percy Steyer"
},
"highlight": {
"Name": [
"<em></em><em></em><em></em><em></em><em></em><em></em>Demetrius Percy Steyer"
]
}
},
{
"_index": "ire-ire-customer-entity-191105050740",
"_type": "Customer",
"_id": "Occupancies:12009931.Customer[1]",
"_score": 109.12074,
"_routing": "9",
"_source": {
"Name": "Demetrius Percy Steyer"
},
"highlight": {
"Name": [
"<em></em><em></em><em></em><em></em><em></em><em></em>Demetrius Percy Steyer"
]
}
},
{
"_index": "ire-ire-customer-entity-191105050740",
"_type": "Customer",
"_id": "Occupancies:12009950.Customer[1]",
"_score": 109.12074,
"_routing": "9",
"_source": {
"Name": "Demetrius Percy Steyer"
},
"highlight": {
"Name": [
"<em></em><em></em><em></em><em></em><em></em><em></em>Demetrius Percy Steyer"
]
}
}
]
}
}