1. A method of searching in an overlay network, comprising: receiving a query at a first node in an distributed network, wherein the query includes a first keyword and a second keyword; finding a first set of a first number of documents that contain the first keyword; computing an optimal first Bloom filter length and a corresponding first number of hash functions as a function of the first number of documents in the first set; and sending a first Bloom filter of the first set to a second node in the distributed network identified by hashing the second keyword, wherein the first Bloom filter comprises the first Bloom filter length and the first number of hash functions.