Updating an Atlas cluster to 4.4 with non dynamic index breaks Full text search

I come to report an issue we experienced with Atlas FTS search indexes when using mongoDB 4.4. We upgraded our M10 cluster from 4.2 to 4.4, and since then none of our search queries worked anymore.

After investigating it, we found that :

  • nested fields don’t work

  • partial searches don’t work (e.g. “covid” doesn’t match “My covid study project”

  • Only first level (not nested) exact matches are returned

Our FTS indexes were set as “dynamic: false” (see below). Once we switched to “dynamic: true”, everything worked again. In case it matters, we also switched from custom index names to “default” in order to avoid specifying the index on each query.

Here is our former FTS index on our “projects” collection:

You need to use the document type for nested documents. Alternatively, using dynamic: true will also find those fields. For example:

{ "mappings":{
              "dynamic": false,
              "fields": {
                "contact": {
                  "type": "document",
                 "fields" : {
                     "lastname" : {
                         "type" : "string",
                        "analyzer" : "lucene.standard"
                     }
                  }
                }}}}

I am not sure if your partial searches is an artifact of the same issue. If not, can you provide the query you used?

2 Likes

Thank you very much for your answer. I’ll check if it is a side effect of not using document type.

The query failign partial matches has been tested in its simplest form, with an aggregation stage like (as I recall):

$search: {
   text: {
     query: ['test'],
     path: ['name']
   }
 }