# Mapping the query to the highlight using FVH

**URL:** <https://discuss.elastic.co/t/mapping-the-query-to-the-highlight-using-fvh/257836>\
**Category:** Elasticsearch\
**Created:** [December 7, 2020, 11:02am UTC](https://discuss.elastic.co/t/mapping-the-query-to-the-highlight-using-fvh/257836 "2020-12-07T11:02:13Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [December 7, 2020, 2:14pm UTC](https://discuss.elastic.co/t/mapping-the-query-to-the-highlight-using-fvh/257836/2 "2020-12-07T14:14:32Z")

</div>

Thanks for the write-up.  
One approach for more transparency into what search terms matched might be to use the highlighter that ships with the [annotated\_text](https://www.elastic.co/blog/search-for-things-not-strings-with-the-annotated-text-plugin) field which is installed as an extra [plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/7.10/mapper-annotated-text.html). Although it's designed for use on `annotated_text` fields it also works with `text` fields and uses a markdown-like syntax for adding annotations to text e.g. given this doc:

```auto
{
	"text": "The new hot technology has emerged!"
}

```

and this query

```auto
{
	"query": {
		"bool": {
			"should": [
				{"match": {"text": "fabulous"}},
				{"match": {"text": "new"}}
			],
			"must": [
				{"match": {"text": "technology"}},
				{"wildcard": {"text": "emerg*"}}
			]
		}
	},
	"highlight": {
		"type": "annotated",
		"fields": {
			"text": {}
		}
	}
}

```

The marked-up result includes which terms matched a section of text:

```auto
        "highlight": {
          "text": [
            "The [new](_hit_term=new) hot [technology](_hit_term=technology) has [emerged](_hit_term=text%3Aemerg*)!"
          ]
        }

```

---

_[View the full topic](https://discuss.elastic.co/t/mapping-the-query-to-the-highlight-using-fvh/257836)._
