1. A method comprising, by one or more index servers of an online social network: receiving, from a client server of the online social network, a search query comprising an inner query and an outer query, the inner query comprising a first edge-type term and a first object identifier, and the outer query comprising a second edge-type term and a second object identifier; executing the inner query by identifying a first set of node objects, each node object in the first set being a source node of one or more first edge objects of an edge type specified by the first edge-type term, each of the one or more edge objects having a destination node corresponding to the first object identifier; executing the outer query by identifying a second set of nodes objects, each node in the second set being a source node of one or more second edge objects of an edge type specified by the second edge-type term, each of the one or more edge object having a destination node corresponding to one of the node objects in the first set; and sending, to the client server, second object identifiers of one or more node objects in the second set.