# Is there a way to match multi-fields but always highlight the base field?

**URL:** <https://discuss.elastic.co/t/is-there-a-way-to-match-multi-fields-but-always-highlight-the-base-field/175797>\
**Category:** Elasticsearch\
**Created:** [April 8, 2019, 8:51am UTC](https://discuss.elastic.co/t/is-there-a-way-to-match-multi-fields-but-always-highlight-the-base-field/175797 "2019-04-08T08:51:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NewHere](https://avatars.discourse-cdn.com/v4/letter/n/5e9695/32.png) [@NewHere](https://discuss.elastic.co/u/NewHere)\
**Post date:** [April 8, 2019, 8:51am UTC](https://discuss.elastic.co/t/is-there-a-way-to-match-multi-fields-but-always-highlight-the-base-field/175797/1 "2019-04-08T08:51:07Z")

</div>

Say I have the following mappings:

```
"phone": {
    "type": "keyword",
    "fields": {
        "digits": {
            "type": "keyword",
            "analyzer": "digit_only"
        }
    }
}

```

The analyzers are using simple\_pattern tokenizer to capture any phone or email in the contact string. A sample data looks like `"phone": "(01)23456-789"`, which will be indexed with the original string and phone 0123456789 (extracted by the regex in tokenizer).

What I want to achieve is no matter how the user issue variations of equivalent numbers, the phone is matched and the original string is returned in highlight value.

At the moment, I managed to get the matched results back by issuing a boolean query one for the `phone` field and one for the `phone.digits` field, however, the highlight sometimes highlights `phone` (when user inputs exactly the original string) or highlights `phone.digits` (when user inputs just numbers).

Is there a way to always highlight the `phone` field no matter the match is on `phone` or `phone.digits`?

---

<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 6, 2019, 8:51am UTC](https://discuss.elastic.co/t/is-there-a-way-to-match-multi-fields-but-always-highlight-the-base-field/175797/2 "2019-05-06T08:51:18Z")

</div>

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