Hi, I created a multiple analyzers for keyword field and I want to do the following:
- If the words matched keyword.exact, the score of the words will multiply by 1.2
- If some other words matched keyword.synonym, the score of the words will multiply by 0.7
- 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