Search code examples
javascriptalgolia

not able to add new object to algolia


I have used all the configuratgions and followed the guide on Algolia (https://www.algolia.com/doc/api-reference/api-methods/add-objects/#examples) and I don't know why it's not working.

I'm using js:

const objects = [{
  firstname: 'Jimmie',
  lastname: 'Barninger'
}, 
{
  firstname: 'Warren',
  lastname: 'Speach'
}];

index.addObjects(objects, (err, content) => {
  console.log(content);
});

I do not get an error and i'm able to use the search but not add a new object. Do I need something else?


Solution

  • I was importing the lite only and not the fullt Algolia.

    wrong:

    import algoliasearch from 'algoliasearch/lite';
    

    right:

    import algoliasearch from 'algoliasearch';