Skip to main content

馃摌 The equals Operator

The equals operator is used to search for a specific value in a field. It is similar to the match operator, but the operation will be performed by Lucene and can be combined with other operators to refine results.

The equals operator has the following syntax. You can find more explanation about it in the documentation.

{
$search: {
"index": <index name>, // optional, defaults to "default"
"equals": {
"path": "<field-to-search>",
"value": <boolean-value>|<objectId>|<number>|<date>,
"score": <score-options>
}
}
}

This could be useful if you wanted to query only for books that were published in a specific year.