# problem on highlighting (sentence cutting)

**URL:** <https://discuss.elastic.co/t/problem-on-highlighting-sentence-cutting/351189>\
**Category:** Elasticsearch\
**Created:** [January 16, 2024, 4:30pm UTC](https://discuss.elastic.co/t/problem-on-highlighting-sentence-cutting/351189 "2024-01-16T16:30:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![minwei.deng](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@minwei.deng](https://discuss.elastic.co/u/minwei.deng)\
**Post date:** [January 16, 2024, 4:30pm UTC](https://discuss.elastic.co/t/problem-on-highlighting-sentence-cutting/351189/1 "2024-01-16T16:30:35Z")

</div>

Hello,

I've a problem on highlighting. When I search for the keyword "éolienne", Elastic highlights **l'** instead of the **l'éolienne**. (see picture problem\_highlight.png)

The complete sentene is :  
"""Daulitz, Domaine de Larroque Vieil, Ferme de Clèche, impasse As Prats, impasse de la Forge, impasse de l’Eolienne, impasse du Merle, impasse du Pinson, impasse Flourac, impasse Loubine, impasse Lucie Aubrac, impasse Pierre Dupont, impasse Redorthe, impasse Roundy"""  
And I got this in highlight :  
"""Daulitz, Domaine de Larroque Vieil, Ferme de Clèche, impasse As Prats,  
impasse de la Forge, impasse de _l’_"""

My query is :  
{  
"highlight": {  
"boundary\_scanner": "sentence",  
"boundary\_scanner\_locale":"fr-FR",  
"fields": {  
"\*": {}  
}  
},  
"query": {  
"bool": {  
"boost": 1,  
"filter": ,  
"must": [  
{  
"multi\_match": {  
"fields": "texte\_extrait.raw",  
"query": "éolienne",  
"type": "phrase"  
}  
}  
]  
}  
}  
}  
In the same index, I've correct highlights in other documents. (see picture highlight\_ok.png)  
I think there is a problem with sentence splitting. Do you have a solution to resolve this problem ?

Thanks a lot.

Minwei DENG

 ![highlight_ok](https://us1.discourse-cdn.com/elastic/original/3X/1/5/154d370ff775978908d23fea12651324e43e9580.png)  
 ![problem_highlight](https://us1.discourse-cdn.com/elastic/original/3X/d/d/dd12b1f478f91027498206a91752c99c21a35aa9.png)

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [January 17, 2024, 10:38am UTC](https://discuss.elastic.co/t/problem-on-highlighting-sentence-cutting/351189/2 "2024-01-17T10:38:44Z")

</div>

Hi @minwei.deng,

Welcome! Can you share your index mapping and which analyzer are you using? Are you using the [standard analyzer or a particular language analyzer](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-analyzers.html)?

---

<div class="post-metadata">

**Author:** ![minwei.deng](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@minwei.deng](https://discuss.elastic.co/u/minwei.deng)\
**Post date:** [January 18, 2024, 9:02am UTC](https://discuss.elastic.co/t/problem-on-highlighting-sentence-cutting/351189/3 "2024-01-18T09:02:59Z")

</div>

Hi @carly.richmond, thanks a lot for looking at my case.

I use this analyzer "analyse\_texte\_libre" :

```auto
"analyse_texte_libre": {
            "filter": [
              "asciifolding",
              "lowercase",
              "fr_worddelimiter",
              "fr_elision",
              "fr_stop",
              "fr_snowball",
              "samepos_unique"
            ],
            "charfilter": [
              "fr_abrev_mapping",
              "urls_filter",
              "html_strip",
              "num_filter"
            ],
            "type": "custom",
            "tokenizer": "standard"
          }

```

And my filters are :

```auto
"filter": {
          "fr_stop": {
            "ignore_case": "true",
            "remove_trailing": "true",
            "type": "stop",
            "stopwords": "_french_"
          },
          "samepos_unique": {
            "type": "unique",
            "only_on_same_position": "true"
          },
          "fr_worddelimiter": {
            "catenate_all": "true",
            "split_on_numerics": "false",
            "language": "french",
            "split_on_case_change": "false",
            "type": "word_delimiter"
          },
          "fr_snowball": {
            "type": "snowball",
            "language": "french"
          },
          "french_stemmer": {
            "type": "stemmer",
            "language": "light_french"
          },
          "fr_elision": {
            "type": "elision",
            "articles": [
              "l",
              "m",
              "t",
              "qu",
              "n",
              "s",
              "j",
              "d",
              "c",
              "jusqu",
              "quoiqu",
              "lorsqu",
              "puisqu",
              "parce qu",
              "parcequ",
              "entr",
              "presqu",
              "quelqu"
            ]
          }

```

And my charfilters are :

```auto
"charfilter": {
          "fr_abrev_mapping": {
            "type": "mapping",
            "mappings": [
              "k€ => milliers d'euros",
              "m€ => millions d'euros",
              "€ => euros",
              "m² => mètres carrés",
              "m2 => mètres carrés",
              "1er => premier",
              "© => copyright",
              ", => ",
              ". => ",
              "; => ",
              ": => ",
              "? => ",
              "! => "
            ]
          },
          "url_filter": {
            "pattern": "(http|ftp|www)\\S*",
            "type": "pattern_replace",
            "replacement": ""
          },
          "num_filter": {
            "pattern": "\\d+",
            "type": "pattern_replace",
            "replacement": " "
          },
          "rem_html": {
            "type": "html_strip"
          }
        }

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 15, 2024, 9:03am UTC](https://discuss.elastic.co/t/problem-on-highlighting-sentence-cutting/351189/4 "2024-02-15T09:03:55Z")

</div>

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