How to Index Date Fields For Faceted Search
On this page
You can use the Atlas Search dateFacet
type for indexing date values for
faceting.
Atlas Search only supports facet queries against fields
indexed as the dateFacet
type. To perform a normal search also
on the same field, you must index the field as type date also.
Atlas Search doesn't dynamically index
date values for faceting. You must use static
mappings to index date values for
faceting. You can use the Visual Editor or the JSON Editor in
the Atlas UI to index date fields as the dateFacet
type.
Review dateFacet
Limitations
The following limitations apply:
You can't index a date field for faceting if it's inside an array or if it's inside a document in an array.
Atlas Search doesn't support date faceting over fields indexed as part of an
embeddedDocuments
field.
Define the Index for dateFacet
Type
To define the index for the dateFacet
type, choose your preferred
configuration method in the Atlas UI and then select the
database and collection.
Configure dateFacet
Field Properties
The Atlas Search dateFacet
type takes the following parameter:
UI Field Name | JSON Option | Type | Necessity | Description |
---|---|---|---|---|
Data Type | type | string | required | Human-readable label that identifies this field type. Value must
be dateFacet . |
Try an Example for dateFacet
Type
The following index definition example uses the sample_mflix.movies collection. If you have the sample data already loaded on your cluster, you can use the Visual Editor or JSON Editor in the Atlas UI to configure the index. After you select your preferred configuration method, select the database and collection, and refine your index to add field mappings.