# Elasticsearch highlight is showing everything in different order and missing statements

**URL:** <https://discuss.elastic.co/t/elasticsearch-highlight-is-showing-everything-in-different-order-and-missing-statements/75794>\
**Category:** Elasticsearch\
**Created:** [February 20, 2017, 9:47pm UTC](https://discuss.elastic.co/t/elasticsearch-highlight-is-showing-everything-in-different-order-and-missing-statements/75794 "2017-02-20T21:47:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashit\_pupu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashit_pupu/32/101113_2.png) [@ashit\_pupu](https://discuss.elastic.co/u/ashit_pupu)\
**Post date:** [February 20, 2017, 9:47pm UTC](https://discuss.elastic.co/t/elasticsearch-highlight-is-showing-everything-in-different-order-and-missing-statements/75794/1 "2017-02-20T21:47:27Z")

</div>

I am working on elasticsearch highlight, if there is exact phrase match then the keywords are to be highlighted. The query is having following multi match query

```
"multi_match" : {
          "query" : "From active node's NSF trace log, ping test failed to receive ECHO from external gateway:\n\n161310 14:16:00 29024 0x7f124bfff700 Unable to receive ECHO reply for 10.32.122.225\n161310 14:16:00 29024 0x7f124bfff700 Pinging failed for 10.32.122.225 for 2 time\n161310 14:16:00 29024 0x7f124bfff700 NSF PINGING COMPLETED for the gateway",
          "fields" : ["stmtcontent.exact"],
          "type" : "phrase"
        }

```

Now the issue is the content is having a field stmtcontent as

```
"stmtcontent": [
          "APG cyclic reboot every hour",
          "\"AP EXTERNAL NETWORK FAULT\" alarm reported on O&M gateway and PS gateway:\n\nAlarm Identifier Class Category Time\n10304:5 A2 APZ yyyy-mm-dd hh:mm:ss\n\nObject of Reference\nA/10.32.122.225\n\nAlarm Text\nAP EXTERNAL NETWORK FAULT\nPROBLEM\nAP EXTERNAL NETWORK \n\nProblem Data\nConnection to remote gateway is down\n\n\nAlarm Identifier Class Category Time\n10304:7 A2 APZ yyyy-mm-dd hh:mm:ss\n\nObject of Reference\nA/10.32.82.129\n\nAlarm Text\nAP EXTERNAL NETWORK FAULT\nPROBLEM\nAP EXTERNAL NETWORK 2 \n\nProblem Data\nConnection to remote gateway on network 2 is down\n",
          "From active node's NSF trace log, ping test failed to receive ECHO from external gateway:\n\n161310 14:16:00 29024 0x7f124bfff700 Unable to receive ECHO reply for 10.32.122.225\n161310 14:16:00 29024 0x7f124bfff700 Pinging failed for 10.32.122.225 for 2 time\n161310 14:16:00 29024 0x7f124bfff700 NSF PINGING COMPLETED for the gateway"
       ]

```

I am using the following analayzer in mapping

```
"metis_exact_analyzer": {
 "filter": [
      "lowercase"
  ],
  "type": "custom",
  "tokenizer": "soft_tokenizer"
  }

  "tokenizer": {
      "soft_tokenizer": {
      "pattern": "(\w*[-*#+=;:\/,~_]*\w+)",
      "type": "pattern",
       "group": "1"
      }
  }

```

the exact match which I am getting is getting distorted and the results are in random. I am unable to identify the solution any help will be great. The result I am getting is :-

```
"stmtcontent.exact" : [" Reference\nA/10.<span style='font-weight: bold;'>32</span>.<span style='font-weight: bold;'>122</span>.<span style='font-weight: bold;'>225</span>\n\nAlarm Text\nAP EXTERNAL NETWORK FAULT\nPROBLEM\nAP EXTERNAL NETWORK \n\nProblem Data", "\nAP EXTERNAL NETWORK FAULT\nPROBLEM\nAP EXTERNAL NETWORK<span style='font-weight: bold;'> 2</span> \n\nProblem Data\nConnection to remote<span style='font-weight: bold;'> gateway</span> on network<span style='font-weight: bold;'> 2</span> is down\n", "\"AP EXTERNAL NETWORK FAULT\" alarm reported on O&M gateway and PS<span style='font-weight: bold;'> gateway</span>:\n\nAlarm Identifier", "\nConnection to remote<span style='font-weight: bold;'> gateway</span> is down\n\n\nAlarm Identifier Class Category Time\n10304:7", " A2 APZ yyyy-mm-dd hh:mm:ss\n\nObject of Reference\nA/10.<span style='font-weight: bold;'>32</span>.82.129\n\nAlarm Text"]

```

the highlights tags which I am using are :-

```
"highlight" : {
"pre_tags" : ["<span style='font-weight: bold;'>"],
"post_tags" : ["</span>"],
"fields" : {
   "stmtcontent.exact" : { }
}
}

```

What am I missing ?? Any help will be appreciated !!!

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 20, 2017, 9:47pm UTC](https://discuss.elastic.co/t/elasticsearch-highlight-is-showing-everything-in-different-order-and-missing-statements/75794/2 "2017-03-20T21:47:38Z")

</div>

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