I have an issue using elasticsearch 5.0 wasting a lot of time in this issue may be you can help me.
I have and index with a lot of products and I set a boost based on some categories with this search:
{
"from": 1,
"size": 10
"query": {
"bool": {
'must': {
'match': {
'NAME': {
"query": "tv",
"operator": "and"
}
},
},
"should": {
"query_string": {
"query": 'category: 23',
"boost": 2
}
}
}
}
This work fine, and the scoring of the results has been changed for these category.
Now we wanna introduce the synonyms for the search and we set the synoynyms as a analyzer in elasticsearch using this method:
"analysis": {
"analyzer": {
"synonym": {
"tokenizer": "whitespace",
"filter": ["lowercase", "asciifolding", "synonym_filter"]
}
},
"filter": {
"synonym_filter": {
"type": "synonym",
"language": "spanish",
"synonyms": [
"tv, television, tdt"
]
}
}
}
We change the query to use the new analyzer and this work fine:
{
"from": 1,
"size": 10
'query': {
'bool': {
'must': {
'match': {
'NAME': {
"query": "television",
"operator": "and",
"analyzer": "synonym"
}
}
}
}
}
}
But when we try to apply boost to this query the result doesnt vary
{
"from": 1,
"size": 10
'query': {
'bool': {
'must': {
'match': {
'NAME': {
"query": "television",
"operator": "and",
"analyzer" => "synonym"
}
},
},
"should": {
"query_string": {
"query": 'category: 23',
"boost" => 2
}
}
}
}
}
Can someone help me?
Regards.