How highlighting work with intervals query?

I have a document:

{
    'title': 'something',
   'text': 'Nova poshta  one  two three four five six seven eight nine  ten words poshta '
}
{
    "query": {
        "intervals": {
            "text" : {
                "all_of": {
                    "max_gaps": 0,
                    "ordered": True,
                    "intervals": [
                            {
                                "match": {
                                    "query": "Nova Poshta",
                                    "use_field": "text.exact",
                                    "analyzer": "default",
                                    "max_gaps": 0
                                }
                            }
                    ] 
                }
                
            }
        }
    },
    "highlight": {
         "pre_tags": ["<em>"],
         "post_tags": ["</em>"],
         "fields": [
             {
                 "text.*": {
                     "type": "plain",
                     "number_of_fragments": 0,
                     "fragmenter": "simple"
                 }
             },
         ]
     },
     "size": 10
}

Elastic give me result:

'highlight': {'text.exact': ['<em>Nova</em> <em>poshta</em>  one  two three four five six seven eight nine  ten words <em>poshta</em> ']}}

Why elastic highlight last word, I set max_gaps=0 for the match? Can someone explain it for me?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.