Query-Driven Indexing in Large-Scale Distributed Systems