To upgrade to the latest version you can run this command:
composer require algolia/algoliasearch-magento-2
If you see this error:
algolia/algoliasearch-magento-2 3.9.0 requires algolia/algoliasearch-client-php 3.2 ->
found algolia/algoliasearch-client-php[3.2.0] but the package is fixed to 3.3.2 (lock
file version) by a partial update and that version does not match.
This is because before version 3.9.0 of the extension, the Algolia Search php client was not locked to version 3.2.0, so it installed the latest version (which was 3.3.2).
To fix this, run this command to downgrade to 3.2.0 first:
composer require algolia/algoliasearch-client-php 3.2
And now you can upgrade with this command:
composer require algolia/algoliasearch-magento-2