The best open source alternative to Algolia is MeiliSearch, which is both free and Open Source. If that doesn't suit you, our users have ranked more than 25 alternatives to Algolia and 19 is open source so hopefully you can find a suitable replacement. Other interesting open source alternatives to Algolia are Apache Solr (Free, Open Source), Sphinx (search engine) (Free, Open Source), Typesense (Free, Open Source) and Manticore search (Free, Open Source).
Solr is an open source enterprise search server based on Lucene search library, with XML/HTTP and JSON APIs. Its major features include powerful full-text search, hit highlighting, faceted search, dynamic clustering, database integration, and rich document handling.
Sphinx is a free software search engine designed with indexing database content in mind. It currently supports MySQL, PostgreSQL, and ODBC-compliant databases as data sources natively. Other data sources can be indexed via pipe in a custom XML format.