Query fails with: search and mongot vector search not enabled

Hi
I’m using MongoDB for the first time, so sorry if this is a basic question. I’m running into an error on the mongo shell connecting to a server running MongoDB version 5.0.14. How should I go about resolving this?

The query:

db.movies.aggregate([
  {
    "$searchMeta": {
      "range": {
        "path": "year",
        "gte": 1998,
        "lt": 1999
      },
      "count": {
        "type": "total"
      }
    }
  }
])

The error:

 Error: command failed: {
	"ok" : 0,
	"errmsg" : "PlanExecutor error during aggregation :: caused by :: search and mongot vector search not enabled! Enable Search by setting serverParameter mongotHost to a valid \"host:port\" string",
	"code" : 31082,
	"codeName" : "Location31082",
	"$clusterTime" : {
		"clusterTime" : Timestamp(1718959965, 1),
		"signature" : {
			"hash" : BsonBinary{type=0, data=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]},
			"keyId" : BsonInt64{value=0}
		}
	},
	"operationTime" : Timestamp(1718959958, 1)
}

This is how my collection looks:
_id title year
667421529003242572ca18bb | Movie 1 | 1997
667421529003242572ca18bc | Movie 2 | 1998
667421529003242572ca18bd | Movie 3 | 1998
667421529003242572ca18be | Movie 4 | 1999
667421529003242572ca18bf | Movie 5 | 2000

Hi @Arnav_Sharma1! Thank you for your question, I think I can help answer it.

This error typically emerges if there is no search index defined in the cluster, which is what enables the process that allows for $search, $vectorSearch, and $searchMeta stages to be run.

I believe this documentation page should help point you in the right direction.