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