indexer: make entities be resources

This will allow to track their lifetime, owners, and also a few extra
fields.

Change-Id: I94c9951171a692f337353428384232b26b3c84fc