Index is undefined‘smartphone’, {
filters: ‘brand:Motorola’
}).then(({ hits }) => {

I get an error says that index is undefined.

Hi there!
It looks like index is not defined in your javascript scope.

Could you confirm that you’re indeed initializing it properly in the same scope as this code ?
Here’s a link to a doc to initialize your index client:

Hope this helps