Match synonyms and match exact word get different scores

Hi, I created a multiple analyzers for keyword field and I want to do the following:

  1. If the words matched keyword.exact, the score of the words will multiply by 1.2
  2. If some other words matched keyword.synonym, the score of the words will multiply by 0.7
  3. Get the sum of above scores

Example:
doc : hi, how are you
query: hello, how are you
keyword.exact should match: how are you
keyword.synonym should match: hello => hi

But now the words that matched keyword.exact will matched in keyword.synonym too..
keyword.exact matched: how are you
keyword.synonym matched: hello => hi + how are you

My mapping:
"keyword": {
"type": "text",
"fields": {
"exact": { "type": "text", "analyzer": "ik" },
"synonym": { "type": "text", "analyzer": "ik_synonym" }
}}

My query:
'query' : { 'bool': {
'should': [
{ 'match' : { 'keyword.exact': { 'query': text, 'boost': 1.2 }}},
{ 'match' : { 'keyword.synonym': { 'query': text, 'boost': 0.7 }}}
]
}}

Can anyone help me?
Best regards

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