Multi-collection indexes
Overview
A multi-collection index is an index which includes documents from more than one collection.
Indexes which cover multiple collections may be less performant than those which cover a single index. If possible, it’s a better practice to organize your collections and queries so that multi-collection indexes are not necessary. |
Example
For demonstration purposes, let’s create two collections named fruit
and flowers
.
The Shell version of this example is not currently available.
The following example adds some documents to the fruit
collection:
The Shell version of this example is not currently available.
Now let’s add some documents to the flowers
collection:
The Shell version of this example is not currently available.
To make these two collections searchable by their color
field, we can
create an index which specifies both collections in the source
field
and color
in the terms
field.
The Shell version of this example is not currently available.
The following example searches the index fruit_and_flowers_search_by_color
for documents with the string red
in the color
field.
The Shell version of this example is not currently available.
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!