I’m currently working with a MongoDB collection where we have a field named customAttributes, which contains dynamic subfields that vary from customer to customer.

We are trying to enable wildcard search on these dynamic subfields using Atlas Search. Since the keys inside customAttributes are not consistent across documents, we attempted to use a dynamic mapping with wildcard support.

Could you please confirm the correct syntax for the search index definition that would:

  • Enable wildcard search on all subfields inside customAttributes
  • Work with dynamic keys
  • Use the appropriate keyword analyzer to support wildcard queries

If possible, could you share a sample index definition that would meet the above requirements?