Create index error: Field limit exceeded

I am trying to create facet index in mongodb atlas search when i am playing with indexes on free tier cluster
it is showing this error

Your index could not be built: Field limit exceeded: 413 > 300

i can’t find anything about this limit in any doc
please provide suggestions

here is json of my index

{
  "mappings": {
    "dynamic": true,
    "fields": {
      "brand": {
        "fields": {
          "tr": [
            {
              "type": "string"
            },
            {
              "type": "stringFacet"
            }
          ]
        },
        "type": "document"
      },
      "qualified": [
        {
          "type": "numberFacet"
        },
        {
          "type": "number"
        }
      ]
    }
  }
}

Hi @Nirali_88988,

I believe the error may be referring to the following limitation (For M0,M2 and M5 tier clusters):

  • Index builds with more than 300 fields fail.

This is noted on the Atlas Search M0 (Free Cluster), M2 and M5 Limitations documentation. However, in saying so, please provide the schema or a few sample documents from the collection that the index is being built on that generates this error.

Regards,
Jason

1 Like

I was able to reproduce a similar error by creating a document with 502 fields on an M0 tier cluster:

Your index could not be built: Field limit exceeded: 502 > 300

You can possibly try setting "mappings.dynamic":false.

I was able to get the index built eventually by turning the Dynamic Mapping to false for the search index and specifying specific fields to index. See the example JSON of this:

{
  "mappings": {
    "dynamic": false, /// <--- set to false
    "fields": {
      "field1": {
        "dynamic": true,
        "type": "document"
      },
      "field2": {
        "dynamic": true,
        "type": "document"
      }
    }
  }
}

Although I did notice I had to delete the original index where the error was generated. Perhaps this may not be the case for you.

Hope this helps.

Regards,
Jason

2 Likes

yes it is working after setting "dynamic": false

Thanks for help :slight_smile:

3 Likes

Awesome - thanks for updating this post and verifying that the change suggested worked out for you :slight_smile:

1 Like

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