Product title autocompletion/suggestions

Hi there,

I'm currently struggling with autocompletion/suggestions. I've got a product database with a title, description, price, etc.

What i want to achieve is for example:

Example: When i search for "ipad", I want to show the following items in a suggestion dropdown:

  • Apple iPad
  • Apple 64GB Wifi + 4G (Blauw) iPad Air (2020)
  • Apple 11-inch iPad Pro (2021) Wi‑Fi

I've tried the completion suggester, which works fine if you know the whole product name because it's suggest from the beginning of the product name..

Now I'm trying a phrase suggester, with the following mapping/config:

'settings' => [
               'analysis' => [
                    'filter' => [
                        'shingle' => [
                            'type' => 'shingle',
                            'min_shingle_size' => 2,
                            'max_shingle_size' => 3,
                        ],
                    ],
                    'analyzer' => [
                        'trigram' => [
                            'type' => 'custom',
                            'tokenizer' => 'standard',
                            'filter' => ['lowercase', 'shingle'],
                        ],
                    ],

            ],
            'mappings' => [
                'properties' => [
                    'title' => [
                        'type' => 'text',
                        'analyzer' => 'ngram_analyzer',
                        'fields' => [
                            'trigram' => [
                                'type' => 'text',
                                'analyzer' => 'trigram',
                            ],
                        ]
                    ],
                ]
            ]
        ]

The query looks like this:

'suggest' => [
                'simple_phrase' => [
                    'text' => $searchQuery,
                    'phrase' => [
                        'field' => 'title.trigram',
                        'confidence' => 0,
                        'collate' => [
                            'query' => [
                                'source' => [
                                    'match_phrase' => [
                                        'title' => '{{suggestion}}'
                                    ]
                                ]
                            ]
                        ],
                        'direct_generator' => [
                            [
                                'field' => 'title.trigram',
                                'suggest_mode' => 'always',
                            ],
                        ],
                        'highlight' => [
                            'pre_tag' => '<em>',
                            'post_tag' => '</em>',
                        ],
                    ],
                ],
            ],
        ]

What happens, is that I only get the suggestion text "ipad" and not the matched product title.

An example site is https://bol.com and try searching for Ipad. I'm trying to achieve such a suggestion list.

Hopefully someone can help me find a solutions.

Kind regards!