How to Index UUID Fields for Efficient Filtering and Sorting
Use Universally Unique Identifiers (UUIDs) when you need values that are virtually guaranteed to be unique.
You can use the Atlas Search uuid
type to index, query, and sort over
BSON Binary Subtype 4 fields.
Define the Index for the uuid
Type
To define the index for the uuid
type, choose your preferred
configuration method in the Atlas UI and then select the
database and collection.
Click Refine Your Index to configure your index.
In the Field Mappings section, click Add Field to open the Add Field Mapping window.
Click Customized Configuration.
Select the field to index from the Field Name dropdown.
Click the Data Type dropdown and select Uuid.
Click Add.
The following is the JSON syntax for the uuid
type.
Replace the default index definition with the following. To learn more
about the fields, see Field Properties.
{ "mappings": { "dynamic": true "fields": { "<field-name>": { "type": "uuid", } } } }
Configure uuid
Field Properties
The Atlas Search uuid
type takes the following parameters:
Option | Type | Necessity | Description |
---|---|---|---|
|
| Required | Human-readable label that identifies this field type.
Value must be |