You are currently browsing legacy 4.1 version of documentation. Click here to switch to the newest 4.2 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Create Multi-Map Index


  • A Multi-Map index allows to index data from multiple different collections.

  • RavenDB will generate a single Multi-Map index.
    The results of querying the Multi-Map index will include data from all these collections.

  • Multi-Map indexes require that all the Map functions defined have the same output structure.

  • In this page:


Creating Multi-Map index

Define a Map Function:
Figure 1. Initial Map Function

  1. Index Name - An index name can be composed of letters, digits, ., /, -, and _. The name must be unique in the scope of the database.

    • Uniqueness is evaluated in a case-insensitive way - you can't create indexes named both usersbyname and UsersByName.
    • The characters _ and / are treated as equivalent - you can't create indexes named both users/byname and users_byname.
    • If the index name contains the character ., it must have some other character on both sides to be valid. /./ is a valid index name, but ./, /., and /../ are all invalid.
  2. The Map Function

  3. Add another map function to create a multi-map index.

The Collection field indexed in the above example is not mandatory but can be useful upon querying.


Add another Map Function:
Figure 2. Add Another Map Function

  • Any number of additional Map functions can be added.

  • Each added Map should have the same output fields.
    i.e. In the above example, the common indexed fields are: Name & Collection.

  • So when querying on this Multi-Map index, results will come from both Employees collection and Companies collection.

  • Index field options, Configuration & Additional Sources can be defined for the Multi-Map index in the same way as done for a Simple Map Index.