Hi Guys,
I am facing some issue in highlighting synonyms which are mapped from Wordnet. It is highlighting irrelevant words while searching.
Here's my code below.
{
"settings" : {
"index" : {
"analysis" : {
"analyzer" : {
"synonym" : {
"tokenizer" : "standard",
"filter" : ["synonym","lowercase"]
}
},
"filter" : {
"synonym" : {
"type": "synonym",
"format" : "wordnet",
"synonyms_path": "analysis/wn_s.pl"
}
}
}
}
},
"mappings": {
"header": {
"properties": {
"test_string": {
"type": "text",
"analyzer": "synonym",
"term_vector": "with_positions_offsets"
}
}
}
}
}
My search query .
{"query": { "query_string": { "query": "info~" }},"highlight": {"pre_tags": [""],"post_tags": [""],"fields" : {"test_string":{}},"fragment_size" :501, "number_of_fragments" : 1}}
Results are as below.
TEST: This area contains the Customer name: TEST Customer Type TEST: This area contains information on the type: TEST DLA
Note : Please click ' new value' column and 'old value' column on the Contract Header page to view complete values.
Note: Transaction report present on Header display only partial value, user need to click ' Old Value' and 'New Value' to view complete.
In the above results , i wanted only "information" to be highlighted , but its highlighting "new" and "old" text. I also analysed the token output and find that it is working as expected but highlight is causing problem.
Elasticsearch version - 6.2.4
Please suggest where I am going wrong. Thanks.