Instructor: The first step to set up the API client is to install the Algolia search package with the package manager. Then we'll create an instance of the client with the app ID and API key of the account you want to use.
These informations are available on your Algolia dashboard. We need an API key with write access to the index you want to push data to. With that kind of variable setup, we can now initialize the index where we want to upload our data to, with the initIndex method.
Here, we simply need to provide the name of the index we want to target. If the index doesn't exist yet, it will be automatically created. Now that our client is ready, let's use it to push some data. The fastest way to do that is directly from the script.
We will simply create an array in our code where we will add two very basic objects, containing a string and a numeric value. Now, we can call the addObjects method, passing in the actors array. We save, and run the script.
Let's head over to the dashboard, and we can see that both actors are there.