title: RavenDB: Indexing documents from multiple collections
body: <p>I have several document collections that occasionally need to be pulled together into a single index for reporting purposes.</p>
  
  <p>This FAQ provides a solution for writing such an index in Raven Studio: <a href="http://ravendb.net/faq/indexing-across-entities" rel="noreferrer">http://ravendb.net/faq/indexing-across-entities</a></p>
  
  <p>While I understand I won't get full compile-time checking, I'm trying to avoid completely unchecked code like this:</p>
  
  <pre><code>public class Assets_ById : AbstractIndexCreationTask
  {
      public override IndexDefinition CreateIndexDefinition()
      {
          return new IndexDefinition
          {
              Map = @"from doc in docs
                      where doc[""@metadata""][""Raven-Entity-Name""] == ""Cars"" ||
                            doc[""@metadata""][""Raven-Entity-Name""] == ""Trains"" ||
                            doc[""@metadata""][""Raven-Entity-Name""] == ""Boats"" ||
                            doc[""@metadata""][""Raven-Entity-Name""] == ""Planes""
                      select new
                      {
                          Cost = doc.Cost,
                          Id = doc.Id,
                          Name = doc.Name,
                          Type = doc.Type,
                      };"
          }
      }
  }
  </code></pre>
  
  <p>Is there something similar to the generic <code>AbstractIndexCreationTask&lt;T&gt;</code> that will allow me to define a heterogeneous index with lambda expressions?</p>