Hello I followed this tutorial Search UI with Elasticsearch | Elastic Documentation and used my own index schema. but I can't get connector.onAutocomplete to work. here is an example:
config = {
...search_config
suggestions: {
types: {
documents: { fields: ['type'] },
},
size: 4,
},
apiConnector: apiConnector
}
I also moved the connector logic to a nextjs backend following NextJS with Elasticsearch Connector | Elastic Documentation and when I trigger await connector.onAutocomplete(requestState, queryConfig);
I get the following error:
Cannot read property 'suggest' of undefined
at CompletionSuggester.<anonymous> (/Users/amineafia/projects/blocktorch/blocktorch-app/node_modules/@searchkit/sdk/lib/cjs/suggestors/CompletionSuggestor.js:40:47)
at Generator.next (<anonymous>)
at fulfilled (/Users/amineafia/projects/blocktorch/blocktorch-app/node_modules/@searchkit/sdk/lib/cjs/suggestors/CompletionSuggestor.js:5:58)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5) {stack: 'TypeError: Cannot read property 'suggest' of …ctions (internal/process/task_queues.js:95:5)', message: 'Cannot read property 'suggest' of undefined'}
Can you please help! what am I missing?
Happy to offer more information if needed