Completion suggester make synonyms rank lower

I am using the completion suggester for typeahead functionality. I have synonyms set up for US states like so la => louisiana. The problem is if, for example, if I query la I get flooded with results for Louisiana, but I need the non-synonyms to rank higher as the user is more likely searching for La Acebeda, Spain or something else with la at the front. The point is I need the synonyms but they should rank lower. Shouldn't this be how it works by default anyway?

This is how my index is setup in elasticsearch 5.4.0:

"suggest": {
        "max_input_length": 50,
        "analyzer": "autocomplete",
        "preserve_position_increments": True,
        "type": "completion",
        "search_analyzer": "synonimize",
        "preserve_separators": True,
        "contexts": [
            {
                "name": "type",
                "type": "category",
                "path": "_type",
            },
        ]
    },

My settings:

'settings': {
        "analysis": {
            "filter": {
                "addy_synonym_filter": {
                    "type": "synonym",
                    "synonyms_path": "/usr/share/elasticsearch/data/synonyms.txt",
                },
            },
            "analyzer": {
                "autocomplete": {
                    "type": "custom",
                    "tokenizer": "lowercase",
                },
                "synonimize": {
                    "tokenizer": "standard",
                    "filter": [
                        "lowercase",
                        "addy_synonym_filter",
                    ]
                }
            }
        }
    }

And my search queries:

 'suggest': {
        'region': {
            'text': "la",
            'completion': {
                'field': 'suggest',
                'size': 15,
                "contexts": {
                    "type": "region"
                }
            },
        },

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