I'm working with elasticsearch and my highlight doesn't give me what I expect .My mappings looks like that :
PUT my_index
{
      "settings": {
           "analysis": {
                "analyzer": {
                     "my_analyzer": {
                          "tokenizer": "my_tokenizer"
                     }
                },
                "tokenizer": {
                     "my_tokenizer": {
                          "type": "ngram",
                          "min_gram": 2,
                          "max_gram": 25,
                          "token_chars": [
                               "letter",
                               "digit"
                          ]
                     }
                }
           }
      }
}
I put some product in my index
PUT index/product/1
{
     "name" : "Kit Guirlande Guinguette 50m Transparent",
     "field2": "foo"
}
PUT index/product/2
{
     "name": "Guirlande Guinguette Blanc 20 Bulbes 10M",
      "field2": "foo"
}
The mapping for name and field2 :
"name": {
    "type": "text",
    "fields": {
      "keyword": {
          "type": "keyword",
          "ignore_above": 256
       }
     },
    "analyzer": "my_analyzer"
},
"fields2": {
    "type": "text",
    "fields": {
        "keyword": {
            "type": "keyword",
            "ignore_above": 256
        }
     },
     "analyzer": "my_analyzer"
},
And I'm doing a research :
GET index/product/_search
{
     "query":{
          "multi_match": {
               "query" : "guirlande gui"
               "fields":[
                    'name','field2'
               ]
              "minimum_should_match" : "100%"
          }
     }
     "highlight" : {
          "fields":{
              "name" : {}
          }
     }
}
Response
{
 "hits": {
      "total": 2,
       "hits": [
             {
                   "_index":"index",
                   "_type": "product",
                   "_id": "1",
                   "_source": {
                         "name": "Guirlande Guinguette Blanc 20 Bulbes 10M"
                    },
                   "highlight": {
                         "name": [
                               " <em>Guirlande Gui</em>nguette Blanc 20 Bulbes 10M"
                         ]
                   }
             },
             {
                   "_index": "index",
                   "_type": "product",
                   "_id": "2",
                   "_score": 1.601195,
                   "_source": {
                         "name": "Kit Guirlande Guinguette 30m Blanche"
                    },
                   "highlight": {
                         "name": [
                               " Kit Guirlande Guinguette 30m Blanche"
                         ]
                   }
             }
       ]
 }
}
But for the second hit in highlight I would like to have " Kit <em>Guirlande Gui</em>nguette 30m Blanche"
 thanks for your time anyway