I’m experiencing an issue when attempting to perform a fuzzy search in a multi analyzer within an embeddedDocument operator. When running the following query:
// Mongo shell query
db.documents.aggregate([
{
$search: {
compound: {
filter: [
{
embeddedDocument: {
path: "lineItems",
operator: {
compound: {
filter: [
{
compound: {
should: [
{
text: {
path: { value: "lineItems.description", multi: "keywordAnalyzer" },
query: "Payment for something veBy valYable",
fuzzy: { maxEdits: 2 }
}
}
],
minimumShouldMatch: 1
}
}
]
}
}
}
}
]
},
returnStoredSource: true
}
}
]);
I get the following error:
MongoServerError: lineItems.description (multi: keywordAnalyzer) not found in index: default
However, when I remove the fuzzy clause from the query, it works fine. This issue only occurs when I combine fuzzy search, multi analyzer, and embeddedDocument operator. The same query works as expected for a different collection which does not use the embeddedDocument operator.
Here is the simplified index configuration related to the field being queried:
{
"analyzer": "lucene.simple",
"searchAnalyzer": "lucene.simple",
"dynamic": false,
"fields": {
"lineItems": {
"type": "document",
"fields": {
"description": {
"analyzer": "lucene.simple",
"multi": {
"keywordAnalyzer": {
"analyzer": "custom.keyword.lowercase",
"type": "string"
}
},
"type": "string"
}
}
}
},
"analyzers": [
{
"name": "custom.keyword.lowercase",
"charFilters": [],
"tokenFilters": [
{
"type": "lowercase"
}
],
"tokenizer": {
"type": "keyword"
}
}
],
"storedSource": {
"include": [
"lineItems.description"
]
}
}
And here is an example document that the query should match:
{
"_id": ObjectId("60b5a2f2f98a5d001f8b87a1"),
"lineItems": [
{
"description": "Payment for something very valuable",
// other fields...
},
// other line items...
],
// other fields...
}
Is this a known issue or limitation with MongoDB Atlas Search, or could this be a bug? Your help in resolving this issue is greatly appreciated.