Context Suggestion query, but allow middle-text searching?

Hi there,

I'm trying to implement an auto-complete type-ahead search feature onto a documentation style website.

I love the speed of the suggestions, and this is definitely the feature I want to use, but, the problem is the "prefix" part of the query
(currently using the official php library, but the query is all the same as if it were in json)

            '_source' => [
            'suggest' => [
                'page-titles' => [
                    'completion' => [
                        'field' => 'suggest',
                        'skip_duplicates' => true,
                        'fuzzy' => [
                            'fuzziness' => 2
                        'contexts' => [
                            'product' => [$product],
                            'document' => [$document],
                            'version' => [$version]
                    'prefix' => $query

So this all works, it certainly lets you look up titles from the beginning and provides fine results.

The problem is that the titles end up being quite long, or, more importantly, more prolific words are used after the first word that a user might be so inclined to type instead (such as a related product name in my case)

So for example, if I have a page title like "Creating {related product name} profile packages", if they were to type in the search "profile", or "profile pac" or even the product name, this page wouldn't show up at all unless they knew to put "creating " first.

So, what should I do here?


It's probably worth it to note that I do not have any control over the values of these titles, they are provided by other teams who have their own workflow and differing authoring styles. It's not realistic to implement or maintain some kind of list of these "prolific" words.

Basically a standard simple match query would suffice.

Also worth noting, that simply supplying the search query to the regex suggester for some reason also does not provide results for middle-text possibilities

Ok so, considering the luke warm temperature of the response

is my only solution here to just run a standard regular query and not use the suggestion engine?

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