# Highlight list of terms containing hyphens and whitespaces

**URL:** <https://discuss.elastic.co/t/highlight-list-of-terms-containing-hyphens-and-whitespaces/230206>\
**Category:** Elasticsearch\
**Created:** [April 28, 2020, 3:21pm UTC](https://discuss.elastic.co/t/highlight-list-of-terms-containing-hyphens-and-whitespaces/230206 "2020-04-28T15:21:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![b1t](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@b1t](https://discuss.elastic.co/u/b1t)\
**Post date:** [April 28, 2020, 3:21pm UTC](https://discuss.elastic.co/t/highlight-list-of-terms-containing-hyphens-and-whitespaces/230206/1 "2020-04-28T15:21:28Z")

</div>

Hello,  
I am realizing a system for keywords matching with ES 7.6 using highlight.  
This is my mappings code:

```auto
    "mappings": {
        "properties": {
            "title": { 
                "type": "text" 
            },
            "description": { 
                "type": "text", 
                "fielddata": True 
            }
        }
    }

```

and this is the query I use:

```auto
"query" : {
	"match": { "description": LIST_OF_KEYWORDS }
},
"highlight" : {
	"pre_tags" : ["<key>"],
	"post_tags" : ["</key>"],
	"fields" : {
		"description" : {"number_of_fragments" : 0 }
	}
}

```

where LIST\_OF\_KEYWORDS contains some keywords like "water-proof, dry, anti fogging".  
So, my intention is to highlight the whole keywords like this:

- `<key>water-proof</key>` insted of `<key>water</key>, <key>proof</key>`
- `<key>anti fogging</key>` insted of `<key>anti</key>, <key>fogginf</key>`

Some idea?

---

<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:** [May 26, 2020, 3:21pm UTC](https://discuss.elastic.co/t/highlight-list-of-terms-containing-hyphens-and-whitespaces/230206/2 "2020-05-26T15:21:29Z")

</div>

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