Thank you for the reference. I commented there sharing the steps to follow in order to replicate the issue.
I am also posting them here in order to keep the discussion updated:
#INDEX SCHEMA
PUT /hybrid_highlight_index
{
"settings": {
"index": {
"knn": true
}
},
"mappings": {
"properties": {
"attachmentData": {
"store": true,
"term_vector": "yes",
"type": "text"
},
"chunk_embedding": {
"dimension": 768,
"type": "knn_vector"
},
"description": {
"store": true,
"term_vector": "yes",
"type": "text"
}
}
}
}
#INGEST PIPELINE
PUT _ingest/pipeline/hybrid_highlight_index_ingest_pipeline
{
"description": "Pipeline di ingestion per core: hybrid_highlight_index",
"processors": [
{
"text_embedding": {
"field_map": {
"attachmentData": "chunk_embedding"
},
"model_id": "py4XKpoBJXee6OmaWDRY"
}
}
]
}
#BULK INGESTION
POST /hybrid_highlight_index/_bulk?pipeline=hybrid_highlight_index_ingest_pipeline
{ "index": {} }
{ "attachmentData": """Wuthering Heights, Emily Brontë's 1847 novel, is a dark, passionate tale set on the bleak Yorkshire moors, exploring obsessive love, revenge, and social class through the destructive relationship of Catherine Earnshaw and Heathcliff, framed by a narrative where outsider Mr. Lockwood hears the tragic story from housekeeper Nelly Dean, revealing a world of fierce emotions and supernatural undertones.""", "description":"""Wuthering Heights - Emily Brontë""" }
{ "index": {} }
{ "attachmentData": """The Magic Mountain (1924) by Thomas Mann is a monumental novel about young German engineer Hans Castorp, who visits his cousin at a tuberculosis sanatorium in the Swiss Alps, intending a short stay but getting drawn into the isolated, timeless world of illness, philosophy, and pre-WWI European culture for seven years, exploring life, death, love (with Clavdia Cauchat), and politics before being pulled back to the "flatland" and the outbreak of war. It's a philosophical bildungsroman (coming-of-age story) using the microcosm of the Berghof sanatorium to reflect the macrocosm of a world on the brink of chaos, contrasting health and sickness, spirit and flesh, and intellect versus instinct. """, "description":"""The Magic Mountain - Thomas Mann""" }
{ "index": {} }
{ "attachmentData": """The Unbearable Lightness of Being's introduction sets up the novel's core philosophical dilemma: the conflict between "lightness" (meaninglessness, freedom from consequence) and "weight" (purpose, responsibility, eternal return), using the backdrop of Prague during the 1968 Soviet invasion to explore these ideas through the interwoven lives of surgeon Tomas, his wife Tereza, his mistress Sabina, and her lover Franz, blending love, politics, and existential questions. It immediately contrasts Nietzsche's eternal return (heavy) with Parmenides' concept of single-occurrence life (light), suggesting life's fleeting moments make choices weightless, a tension central to the characters' struggles with love, fidelity, and freedom. """, "description":"""The Unbearable Lightness of Being - Milan Kundera""" }
#CHECK RECORDS
GET hybrid_highlight_index/_search
{
"query": {
"match_all": {}
}
}
#SEARCH PIPELINE
PUT /_search/pipeline/hybrid_highlight_index_search_pipeline
{
"phase_results_processors": [
{
"normalization-processor": {
"normalization": {
"technique": "min_max"
},
"combination": {
"technique": "arithmetic_mean",
"parameters": {
"weights": [
0.5,
0.5
]
}
}
}
}
],
"request_processors": [
{
"neural_query_enricher": {
"default_model_id": "py4XKpoBJXee6OmaWDRY"
}
}
]
}
#SEARCH WITH HIGHLIGHT (highlight not returned)
GET hybrid_highlight_index/_search?search_pipeline=hybrid_highlight_index_search_pipeline
{
"highlight": {
"pre_tags": [
"<strong>"
],
"post_tags": [
"</strong>"
],
"fields": {
"attachmentData": {}
}
},
"size": 50,
"query": {
"hybrid": {
"queries": [
{
"query_string": {
"query": "Swiss~1 Alps~1",
"fields": [
"description^2.0",
"attachmentData"
]
}
},
{
"neural": {
"chunk_embedding": {
"query_text": "Swiss Alps"
}
}
}
]
}
},
"_source": {
"excludes": "chunk_embedding"
}
}
#SEARCH WITH HIGHLIGHT WITH HIGHLIGHT QUERY (highlight not returned)
GET hybrid_highlight_index/_search?search_pipeline=hybrid_highlight_index_search_pipeline
{
"highlight": {
"pre_tags": [
"<strong>"
],
"post_tags": [
"</strong>"
],
"fields": {
"attachmentData": {
"highlight_query": {
"query_string": {
"query": "Swiss~1 Alps~1",
"fields": [
"attachmentData"
]
}
}
}
}
},
"size": 50,
"query": {
"hybrid": {
"queries": [
{
"query_string": {
"query": "Swiss~1 Alps~1",
"fields": [
"description^2.0",
"attachmentData"
]
}
},
{
"neural": {
"chunk_embedding": {
"query_text": "Swiss Alps"
}
}
}
]
}
},
"_source": {
"excludes": "chunk_embedding"
}
}