# Highlighting copied fields in percolate queries

**URL:** <https://discuss.elastic.co/t/highlighting-copied-fields-in-percolate-queries/219768>\
**Category:** Elasticsearch\
**Created:** [February 18, 2020, 11:15am UTC](https://discuss.elastic.co/t/highlighting-copied-fields-in-percolate-queries/219768 "2020-02-18T11:15:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![smatamoros](https://avatars.discourse-cdn.com/v4/letter/s/43a26b/32.png) [@smatamoros](https://discuss.elastic.co/u/smatamoros)\
**Post date:** [February 18, 2020, 11:15am UTC](https://discuss.elastic.co/t/highlighting-copied-fields-in-percolate-queries/219768/1 "2020-02-18T11:15:54Z")

</div>

Hi,

I'm working with a use case where the results of percolate queries must been highlighted. With normal fields it works fine but I have problems with fields which content has been copied from other field.

Here is an example.

The mappings

```json
"mappings": {
        "title" : {
          "type" : "text",
          "fields" : {
            "prefix" : {
              "type" : "text",
              "analyzer" : "normal_prefix",
              "search_analyzer" : "normal_query"
            }
          },
          "copy_to" : [
            "title_sensible"
          ],
          "analyzer" : "normal",
          "search_analyzer" : "normal_query"
        },
        "title_sensible" : {
          "type" : "text",
          "store" : true,
          "fields" : {
            "prefix" : {
              "type" : "text",
              "analyzer" : "sensible_prefix",
              "search_analyzer" : "sensible_query"
            }
          },
          "analyzer" : "sensible",
          "search_analyzer" : "sensible_query"
        },
        "tquery" : {
          "type" : "percolator"
        }
}

```

The stored queries

```json
{
    "tquery" : {
        "match" : {
            "title" : "precio"
        }
    } 
}

```

```json
{
    "tquery" : {
        "match" : {
            "title_sensible" : "Madrid"
        }
    } 
}

```

The search request

```json
{
  "query": {
    "percolate": {
      "field": "tquery",
      "document": {
        "title": "La subida de precio del alquiler en Madrid está provocando una marea"
      }
    }
  },
  "highlight": {
        "fields": {
          "title" : {}
        }
  }
}

```

And the results

```json
    "hits" : [
      {
        "_index" : "tracking-i6",
        "_type" : "_doc",
        "_id" : "AAEFE2C9ED1CED7F5D748C1DA8A104B9",
        "_score" : 0.13076457,
        "_source" : {
          "tquery" : {
            "term" : {
              "title" : {
                "value" : "precio",
                "boost" : 1.0
              }
            }
          }
        },
        "fields" : {
          "_percolator_document_slot" : [
            0
          ]
        },
        "highlight" : {
          "title" : [
            "La subida de <em>precio</em> del alquiler en Madrid está provocando una marea"
          ]
        }
      },
      {
        "_index" : "tracking-i6",
        "_type" : "_doc",
        "_id" : "6DAD52D208A659E0C52C6326C84A5B59",
        "_score" : 0.13076457,
        "_source" : {
          "tquery" : {
            "term" : {
              "title_sensible" : {
                "value" : "Madrid",
                "boost" : 1.0
              }
            }
          }
        },
        "fields" : {
          "_percolator_document_slot" : [
            0
          ]
        }
      }
]

```

The percolate query works great but the result is not been highlighted in the title\_sensible case.

Any idea? Am I doing anything wrong?

Thanks!

---

<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:** [March 17, 2020, 11:15am UTC](https://discuss.elastic.co/t/highlighting-copied-fields-in-percolate-queries/219768/2 "2020-03-17T11:15:55Z")

</div>

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