# How to highlight any field in document which contain searched string?

**URL:** <https://discuss.elastic.co/t/how-to-highlight-any-field-in-document-which-contain-searched-string/71488>\
**Category:** Elasticsearch\
**Created:** [January 13, 2017, 7:55am UTC](https://discuss.elastic.co/t/how-to-highlight-any-field-in-document-which-contain-searched-string/71488 "2017-01-13T07:55:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rudolf\_Reddy\_Macejka](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rudolf_reddy_macejka/32/12875_2.png) [@Rudolf\_Reddy\_Macejka](https://discuss.elastic.co/u/Rudolf_Reddy_Macejka)\
**Post date:** [January 13, 2017, 7:55am UTC](https://discuss.elastic.co/t/how-to-highlight-any-field-in-document-which-contain-searched-string/71488/1 "2017-01-13T07:55:11Z")

</div>

Hello,

I am trying to build a full-text search query over thousand of documents with dynamic structure.

But the highlight method works only for specifically named fields.

If I want to use search over \_all or \_source it doesn't show any hihlighted result.

I already tried many various and tried to "googling" but with no success.

Basic query:

```
POST tracking*/_search
{
    "query": {
    "query_string": {
      "query": "ci1483967534008.6100622@czcholsint372_te"
    }
  },
  "highlight": {
    "require_field_match": false
  }
}

```

will return:

```
  "hits": {
    "total": 8,
    "max_score": 13.482396,
    "hits": [
      {
        "_index": "tracking-2017.01.09",
        "_type": "cyclone",
        "_id": "Cyclone1-UAT-ci1483967534008.6100622@czcholsint372_te-Messaging.Message.MessageUnpackaged.Request",
        "_score": 13.482396,
        "_source": {
        ... truncated ...
          "received": "2017-01-09T13:12:14.008Z",
          "tags": [],
          "@timestamp": "2017-01-09T13:12:14.008Z",
          "size": "3169",
          "pairing": " ci1483967534008.6100622@czcholsint372_te <60a93b9-159835b287e-159835b79041a66cd1@ip.net> ErpExJets_RDC1_ProcessPurchaseOrder_9.4.1_20170109131207169 ErpExJets_RDC1_ProcessPurchaseOrder_9.4.1_20170109131207169",
        }
      },

```

but no highlight even if the searched string is in the pairing field.

Is it possible at all?

Thanks  
Reddy

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [January 13, 2017, 1:14pm UTC](https://discuss.elastic.co/t/how-to-highlight-any-field-in-document-which-contain-searched-string/71488/2 "2017-01-13T13:14:53Z")

</div>

If the documents have truly dynamic structure you might want to normalize  
it somehow. Elasticsearch doesn't do well with tens of thousands of sparse  
fields. Each one has an overhead, etc. You can highlight against "\*" but  
that will try each one, one after the other so it isn't particularly  
efficient.

---

<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 10, 2017, 1:14pm UTC](https://discuss.elastic.co/t/how-to-highlight-any-field-in-document-which-contain-searched-string/71488/3 "2017-02-10T13:14:52Z")

</div>

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