What does InitIndex do?

I am trying to read the data using the c# Algolia.Search library. The data I want is already within an index. Using my Search API Key, I do:

    public GetAlgoliaData()
        AlgoliaClient client = new AlgoliaClient(algoliaApplicationId, algoliaSearchApiKey);

I am confused by InitIndex… that seems to me that it is used to create a new index or update an index. Is this the proper way if one only wants to retrieve data? I am afraid that this will kill my production index.


Hello @ecoffman,

Thank you for reaching us,

The InitIndex method is used to connect your client to an index. If you want to only search data with this client, you can use your “Search only API Key”. You will be sure to not destroy your production index :slight_smile:

You can read more about this method in the API client documentation: https://www.algolia.com/doc/api-client/csharp/getting-started/?language=csharp#init-index

Cheers, Maxime.

1 Like