Firebase: Backend search engine choices

I’m making an app that will have a search engine component: users can upload content and other users can search for it, ideally by keywords, related terms, etc. My question is what’s the best way to do that.

I’m planning to implement the backend mostly in firebase. I could do table scans with firebase queries, but it seems like it would be pretty taxing on the framework and not really what it’s designed for. What’s the right way to solve this problem? Thanks!

One solution could be Elasticsearch:

Alternative (and also Algolia):

For special cases there are special solutions like this one: (autosuggest search)