Elasticsearch : Completion suggester not working with whitespace Analyzer

The completion suggester cannot perform full-text queries, which means that it cannot return suggestions based on words in the middle of a multi-word field.

From ElasticSearch itself:

The reason is that an FST query is not the same as a full text query. We can't find words anywhere within a phrase. Instead, we have to start at the left of the graph and move towards the right.

As you discovered, the best alternative to the completion suggester that can match the middle of fields is an edge n-gram filter.


gI know this question is ages old, but have you tried have multiple suggestions, one based on prefix and the next one based in regex ?

Something like

{
    "suggest": {
        "test-suggest-exact" : {
            "prefix" :"ela", 
            "completion" : { 
                "field" : "suggest",
                "skip_duplicates": true
            }
        },
        "test-suggest-regex" : {
            "regex" :".*ela.*", 
            "completion" : { 
                "field" : "suggest",
                "skip_duplicates": true
            }
        }
    }
}

Use results from the second suggest when the first one is empty. The good thing is that meaningful phrases are returned by the Elasticsearch suggest.

Shingle based approach, using a full query search and then aggregating based on search terms sometimes gives broken phrases which are contextually wrong. I can write more if you are interested.