moreLikeThis unsupported inside embeddedDocument operator?

There doesn’t seem to be an exclusion listed in the documentation. I am sending the following agg to mongo:

db.people.aggregate([
{
    "$search": {
      "embeddedDocument": {
          "path": "names",
          "operator": {
            "moreLikeThis": {
                 "like": {
                    "names.name": "tester"
                   }
                }
          }
      }
   }
  }
])

Which generates the following error every time:

MongoServerError: java.lang.AssertionError: unreachable
    at Connection.onMessage (/Applications/MongoDB Compass.app/Contents/Resources/app.asar.unpacked/node_modules/@mongosh/node-runtime-worker-thread/dist/worker-runtime.js:1917:3099431)
    at MessageStream.<anonymous> (/Applications/MongoDB Compass.app/Contents/Resources/app.asar.unpacked/node_modules/@mongosh/node-runtime-worker-thread/dist/worker-runtime.js:1917:3096954)
    at MessageStream.emit (node:events:394:28)
    at c (/Applications/MongoDB Compass.app/Contents/Resources/app.asar.unpacked/node_modules/@mongosh/node-runtime-worker-thread/dist/worker-runtime.js:1917:3118818)
    at MessageStream._write (/Applications/MongoDB Compass.app/Contents/Resources/app.asar.unpacked/node_modules/@mongosh/node-runtime-worker-thread/dist/worker-runtime.js:1917:3117466)
    at writeOrBuffer (node:internal/streams/writable:389:12)
    at _write (node:internal/streams/writable:330:10)
    at MessageStream.Writable.write (node:internal/streams/writable:334:10)
    at TLSSocket.ondata (node:internal/streams/readable:749:22)
    at TLSSocket.emit (node:events:394:28)

The mappings are correct as well. In the above example “names” is mapped as type: ‘embeddedDocuments’ and ‘name’ as type string. Is this a bug or just unsupported?

Hi Luke_Snyder, thanks for your question!

Sorry about the confusion here - the moreLikeThis operator is indeed not supported within the embeddedDocument operator, and I have filed a ticket to call that out in our documentation.

I am not sure if this is a “real” query/if this is an example designed to highlight this issue - but if this is a real query, you might try using a text operator inside the embeddedDocument operator instead of using moreLikeThis:

{
  "embeddedDocument": {
    "path": "names",
    "operator": {
      "text": {
        "path": "names.name",
        "query": "tester"
      }
    }
  }
}