Atlas Docker Image - Fail to create search index, stuck on building

Hi there,

I’ve been trying to create a search index using the latest mongo:atlas docker image via the following commands:

docker run -d -p 27017:27017 --privileged --name mongo-atlas mongodb/atlas
docker exec -it mongo-atlas bash
atlas deployments setup --type local --port 27017 --bindIpAll --username user --password password
use admin
db.grantRolesToUser('user', [{ role: 'root', db: 'admin' }])
db.fileEmbeddings.insertOne({"embedding":[-0.039916280657052994,-0.06606404483318329,0.019937394186854362,-0.011219979263842106,0.0314403735101223], "conversationId": "abc123", "sessionId": "my-session"})
db.fileEmbeddings.createSearchIndex("file_embedding_index", {"mappings": {"dynamic": false,"fields": {"embedding": {"dimensions": 5,"similarity": "cosine","type": "knnVector"},"conversationId": {"type": "token"},"sessionId": {"type": "token"}}}})

When I checked on search index via db.fileEmbeddings.getSearchIndexes(), I see:
name: 'file_embedding_index', type: 'search', status: 'BUILDING', queryable: false,

I then checked the db.currentOp() and could see there is mongot active as true. I then checked the deployment logs via atlas deployments logs and could see:
{"t":{"$date":"2024-04-19T06:53:09.013+00:00"},"s":"I", "c":"CONNPOOL", "id":22576, "ctx":"SearchIndexMgmtExecutor","msg":"Connecting","attr":{"hostAndPort":"10.89.0.11:27027"}} {"t":{"$date":"2024-04-19T06:53:09.320+00:00"},"s":"I", "c":"COMMAND", "id":51803, "ctx":"conn25","msg":"Slow query","attr":{"type":"command","ns":"local.$cmd","appName":"mongosh 2.1.3","command":{"createSearchIndexes":"fileEmbeddings","indexes":[{"name":"file_embedding_index","definition":{"mappings":{"dynamic":false,"fields":{"embedding":{"dimensions":5,"similarity":"cosine","type":"knnVector"},"conversationId":{"type":"token"},"userId":{"type":"token"},"sessionId":{"type":"token"}}}}}],"lsid":{"id":{"$uuid":"2f95a021-35ec-4576-8d18-c4925535a23b"}},"$clusterTime":{"clusterTime":{"$timestamp":{"t":1713509502,"i":1}},"signature":{"hash":{"$binary":{"base64":"3BtCPjOVOnxqtFQUvQLGCKlZSIQ=","subType":"0"}},"keyId":7359466155783749639}},"$db":"local"},"numYields":0,"reslen":256,"locks":{},"readConcern":{"level":"local","provenance":"implicitDefault"},"cpuNanos":977125,"remote":"10.89.0.1:43146","protocol":"op_msg","durationMillis":307}} {"t":{"$date":"2024-04-19T06:53:09.340+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"10.89.0.11:39194","uuid":{"uuid":{"$uuid":"800bba2d-68ec-411c-b0fd-5ed08fcccc69"}},"connectionId":28,"connectionCount":16}} {"t":{"$date":"2024-04-19T06:53:09.342+00:00"},"s":"I", "c":"NETWORK", "id":51800, "ctx":"conn28","msg":"client metadata","attr":{"remote":"10.89.0.11:39194","client":"conn28","negotiatedCompressors":[],"doc":{"driver":{"name":"mongo-java-driver|sync","version":"4.4.2"},"os":{"type":"Linux","name":"Linux","architecture":"aarch64","version":"5.10.76-linuxkit"},"platform":"Java/Eclipse Adoptium/11.0.14+9","application":{"name":"mongot initial sync and session refresh"}}}} {"t":{"$date":"2024-04-19T06:53:09.342+00:00"},"s":"I", "c":"ACCESS", "id":6788604, "ctx":"conn28","msg":"Auth metrics report","attr":{"metric":"acquireUser","micros":0}} {"t":{"$date":"2024-04-19T06:53:09.363+00:00"},"s":"I", "c":"ACCESS", "id":5286306, "ctx":"conn28","msg":"Successfully authenticated","attr":{"client":"10.89.0.11:39194","isSpeculative":true,"isClusterMember":true,"mechanism":"SCRAM-SHA-256","user":"__system","db":"local","result":0,"metrics":{"conversation_duration":{"micros":20969,"summary":{"0":{"step":1,"step_total":2,"duration_micros":103},"1":{"step":2,"step_total":2,"duration_micros":28}}}},"extraInfo":{}}} {"t":{"$date":"2024-04-19T06:53:09.367+00:00"},"s":"I", "c":"NETWORK", "id":6788700, "ctx":"conn28","msg":"Received first command on ingress connection since session start or auth handshake","attr":{"elapsedMillis":4}} {"t":{"$date":"2024-04-19T06:53:09.499+00:00"},"s":"I", "c":"COMMAND", "id":518070, "ctx":"conn28","msg":"CMD: drop","attr":{"namespace":"local.mongot-changestream-buffer-662214d55033ee42c1a84931-u0-f5"}} {"t":{"$date":"2024-04-19T06:53:39.568+00:00"},"s":"I", "c":"COMMAND", "id":518070, "ctx":"conn28","msg":"CMD: drop","attr":{"namespace":"local.mongot-changestream-buffer-662214d55033ee42c1a84931-u0-f5"}} {"t":{"$date":"2024-04-19T06:54:09.608+00:00"},"s":"I", "c":"COMMAND", "id":518070, "ctx":"conn28","msg":"CMD: drop","attr":{"namespace":"local.mongot-changestream-buffer-662214d55033ee42c1a84931-u0-f5"}} {"t":{"$date":"2024-04-19T06:54:39.665+00:00"},"s":"I", "c":"COMMAND", "id":518070, "ctx":"conn28","msg":"CMD: drop","attr":{"namespace":"local.mongot-changestream-buffer-662214d55033ee42c1a84931-u0-f5"}} {"t":{"$date":"2024-04-19T06:55:09.730+00:00"},"s":"I", "c":"COMMAND", "id":518070, "ctx":"conn28","msg":"CMD: drop","attr":{"namespace":"local.mongot-changestream-buffer-662214d55033ee42c1a84931-u0-f5"}} {"t":{"$date":"2024-04-19T06:55:39.777+00:00"},"s":"I", "c":"COMMAND", "id":518070, "ctx":"conn28","msg":"CMD: drop","attr":{"namespace":"local.mongot-changestream-buffer-662214d55033ee42c1a84931-u0-f5"}} {"t":{"$date":"2024-04-19T06:56:09.829+00:00"},"s":"I", "c":"COMMAND", "id":518070, "ctx":"conn28","msg":"CMD: drop","attr":{"namespace":"local.mongot-changestream-buffer-662214d55033ee42c1a84931-u0-f5"}} {"t":{"$date":"2024-04-19T06:56:39.874+00:00"},"s":"I", "c":"COMMAND", "id":518070, "ctx":"conn28","msg":"CMD: drop","attr":{"namespace":"local.mongot-changestream-buffer-662214d55033ee42c1a84931-u0-f5"}} {"t":{"$date":"2024-04-19T06:57:09.917+00:00"},"s":"I", "c":"COMMAND", "id":518070, "ctx":"conn28","msg":"CMD: drop","attr":{"namespace":"local.mongot-changestream-buffer-662214d55033ee42c1a84931-u0-f5"}} {"t":{"$date":"2024-04-19T06:57:39.971+00:00"},"s":"I", "c":"COMMAND", "id":518070, "ctx":"conn28","msg":"CMD: drop","attr":{"namespace":"local.mongot-changestream-buffer-662214d55033ee42c1a84931-u0-f5"}} {"t":{"$date":"2024-04-19T06:58:10.004+00:00"},"s":"I", "c":"COMMAND", "id":518070, "ctx":"conn28","msg":"CMD: drop","attr":{"namespace":"local.mongot-changestream-buffer-662214d55033ee42c1a84931-u0-f5"}} {"t":{"$date":"2024-04-19T06:58:29.342+00:00"},"s":"I", "c":"CONNPOOL", "id":22572, "ctx":"SearchIndexMgmtExecutor","msg":"Dropping all pooled connections","attr":{"hostAndPort":"10.89.0.11:27027","error":"ConnectionPoolExpired: Pool for 10.89.0.11:27027 has expired."}} {"t":{"$date":"2024-04-19T06:58:40.048+00:00"},"s":"I", "c":"COMMAND", "id":518070, "ctx":"conn28","msg":"CMD: drop","attr":{"namespace":"local.mongot-changestream-buffer-662214d55033ee42c1a84931-u0-f5"}}

It seems like there is something causing issues in mongot but this is as far as I could debug. Please help me investigate. Appreciate any help. Thanks, Peter.

Thanks for reporting this @Peter_Flook
It appears that you are using the admin database in your tests, which is an internal database. Unfortunately, creating search indexes is not supported on the admin database. Could you please try running your example using a different database, such as testSearch`, and let us know if that resolves the issue?

1 Like

Hi @Ciprian_Tibulca , thanks for the reply. Looks all good now! Here are the steps I used in case others need them for reference.

AtlasLocalDev rs-localdev [direct: primary] local> use testSearch
switched to db testSearch
AtlasLocalDev rs-localdev [direct: primary] testSearch> db.fileEmbeddings.insertOne({"embedding":[-0.039916280657052994,-0.06606404483318329,0.019937394186854362,-0.011219979263842106,0.0314403735101223], "conversationId": "abc123", "sessionId": "my-session"})
{
  acknowledged: true,
  insertedId: ObjectId('6628a739e7a68bef803b9276')
}
AtlasLocalDev rs-localdev [direct: primary] testSearch> db.fileEmbeddings.createSearchIndex("file_embedding_index", {"mappings": {"dynamic": false,"fields": {"embedding": {"dimensions": 5,"similarity": "cosine","type": "knnVector"},"conversationId": {"type": "token"},"sessionId": {"type": "token"}}}})
file_embedding_index
AtlasLocalDev rs-localdev [direct: primary] testSearch> db.fileEmbeddings.getSearchIndexes()
[
  {
    id: '6628a7401d639f2042ece2da',
    name: 'file_embedding_index',
    type: 'search',
    status: 'READY',
    queryable: true,
    latestVersion: 0,
    latestDefinition: {
      mappings: {
        dynamic: false,
        fields: {
          conversationId: { type: 'token' },
          embedding: { type: 'knnVector', dimensions: 5, similarity: 'cosine' },
          sessionId: { type: 'token' }
        }
      }
    }
  }
]

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.