Skip to content

Bug: Unified Highlighter does not care about fragment_size #28462

@aslamy

Description

@aslamy

I have:

Elasticsearch 6.1.2

Mapping:

PUT my_index
{  
   "mappings":{  
      "my_type":{  
         "properties":{  
            "title":{  
               "term_vector":"with_positions_offsets",
               "type":"text"
            }
         }
      }
   }
}
PUT my_index/my_type/1
{  
   "title":"Hello. This is a test."
}

Search:

{  
   "query":{  
      "match":{  
         "title":"Hello"
      }
   },
   "highlight":{  

      "fields":{  
         "title":{  
            "fragment_size":1000,
            "number_of_fragments":1,
	    "type": "unified"
         }
      }
   }
}

Result:

{  
   "took":0,
   "timed_out":false,
   "_shards":{  
      "total":5,
      "successful":5,
      "skipped":0,
      "failed":0
   },
   "hits":{  
      "total":1,
      "max_score":0.2876821,
      "hits":[  
         {  
            "_index":"my_index",
            "_type":"my_type",
            "_id":"1",
            "_score":0.2876821,
            "_source":{  
               "title":"Hello. This is a test."
            },
            "highlight":{  
               "title":[  
                  "<em>Hello</em>."
               ]
            }
         }
      ]
   }
}

Problem:
It seems that unified highlighter does not care about fragment size. When fragment_size is 1000 it should not split but it does split on first point (dot). I know if fragment_size = 0 then it not split, but that's not what I want.
I have fields with many sentence I want to split around 256 characters, but highlighter splitting always on first point hit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions