# Elasticsearch Highlighting against specific query filters

**URL:** <https://discuss.elastic.co/t/elasticsearch-highlighting-against-specific-query-filters/165448>\
**Category:** Elasticsearch\
**Created:** [January 23, 2019, 4:03pm UTC](https://discuss.elastic.co/t/elasticsearch-highlighting-against-specific-query-filters/165448 "2019-01-23T16:03:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![r111\_2019](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@r111\_2019](https://discuss.elastic.co/u/r111_2019)\
**Post date:** [January 23, 2019, 4:03pm UTC](https://discuss.elastic.co/t/elasticsearch-highlighting-against-specific-query-filters/165448/1 "2019-01-23T16:03:58Z")

</div>

My question is, can an Elastic Query be written, such that I can implement highlighting against specific filters that I write? For example, suppose I have the following bool filters applied to my query:

```auto
      {
        "query_string": {
           "query": "Harry Potter",
           "fields": [
                      "document.metadata.title^1.0",
                     ],
           ...
           },
      },
      {
      "query_string": {
           "query": "Rowling",
           "fields": [
                      "document.metadata.author^1.0",
                     ],
           ...
           },
      }, 
      ]
    ...
    "highlight" {
       "fields": {
          "report.metadata.title":{
             "fragment_size": 100
          },
          "report.metadata.author":{
             "fragment_size": 100
          }
    }
    }

```

In this scenario, I wish to report highlighting on the following:

```auto
1. Title contains "Harry Potter" - Highlighting = TRUE
2. Author contains "Harry Potter" - Highlighting = FALSE
3. Title contains "Rowling" - Highlighting = FALSE
4. Author contains "Rowling" - Highlighting = TRUE

```

Is this possible? Many thanks in advance

---

<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 20, 2019, 4:17pm UTC](https://discuss.elastic.co/t/elasticsearch-highlighting-against-specific-query-filters/165448/2 "2019-02-20T16:17:41Z")

</div>

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