Searching actors in a cluster

I have a use case that is pretty perfect for Akka Cluster Sharding except for one thing. Each entity will have a string as part of its state, and while almost all the application needs can be accomplished by maintaining that state, there is also a need to search the collection of entities by those strings - think autocomplete given substrings, where the persistenceId is the information that would be returned.

I am curious how other people have combined akka cluster sharding with searching, where you are searching by a field that would normally be part of the state of the actor. It seems the alternatives are:

  1. Use a separate horizontally scalable repository that can be queried, like cassandra, that will associate these strings with the persistence ids for the actors/entities. This would require each actor to write to the repository when the relevant part of its state gets updated. (Not the same as using akka persistence as it would be a different repository schema.)

  2. Write a custom layer to query the akka persistence schema directly, although this seems improper, and impractical anyway given how the serialized events and snapshots are stored.

  3. Integrate a distributed in-memory cache (probably backed with some persistence repository) where you can search by value, that integrates well with akka, if there is anything like this.

  4. I checked to see if Distributed Data would be a fit, but I wasn’t sure if that worked well for searching by value, plus I think this would involve more records than DD is a good fit for anyway.

Any suggestions? It seems like it would be a pretty common need to search among entities in a cluster.

I think the most common solution to this is to use Akka Persistence Query to consume events and build a separate projection that can be searched. Tagging of events and using eventsByTag to consume them and update the projection (other DB). https://doc.akka.io/docs/akka/current/persistence-query.html