Skip to Main Content

MongoByte MongoDB Logo

Welcome to the new MongoDB Feedback Portal!

{Improvement: "Your idea"}
We’ve upgraded our system to better capture and act on your feedback.
Your feedback is meaningful and helps us build better products.

Status Submitted
Categories Atlas Search
Created by Guest
Created on Jul 12, 2023

wildcard paths in index specifications

It would make index specification easier in some cases if wildcards were possible in the paths. Yes we have dynamic indexing, but to keep the index size minimal and to be more flexible I want to index only the fields I really need. Consider the following example: Example document: { foo: { de: { field1: 'bar', field2: 'bar' }, en: { field1: 'bar', field2: 'bar' }, fr: { field1: 'bar', field2: 'bar' }, } } Index specification: { "mappings": { "dynamic": false, "fields": { "foo": { "type": "document", "dynamic": false, "fields": { "$**": { "type": "document", "dynamic": false, "fields": { "field1": { "type": "string" } } } } } } } } This index would then index field1 in the object foo.*, where * stands for any field. So in this example foo.DE, foo.EN, foo.FR. This extension would help when you want to index nested objects where the field names of a layer are unknown or strongly dynamic, but dynamic: true would have too many unwanted side effects.