Index definitions
See Indexes |
---|
Defines an index.
An index stores, or covers, specific document field values for quick retrieval. Using indexes can significantly improve query performance and reduce costs, especially for large datasets.
You include index definitions in a collection schema.
Name
- indexName String Required
-
Unique index name.
Properties
Property | Type | Required | Description |
---|---|---|---|
terms |
Array of field accessors |
Yes, if values is not defined. |
Fields used for exact match searches. Supports dot notation and bracket notation. You can only index persistable field values. Use |
values |
Array of field accessors |
Yes, if terms is not defined. |
Fields used for sorting and range searches. Supports dot notation and bracket notation. You can only index persistable field values. Use Use |
Examples
collection Product {
...
index byName {
terms [.name]
values [desc(.stock), desc(mva(.productTypes))]
}
...
}
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!