Mongo-Connector https://github.com/mongodb-labs/mongo-connector is a perfect solution to move the data from Mongo Databases to target systems like Solr, ElasticSearch, etc...
This connector offers several options which are used to exclude fields, exclude collections, exclude namespaces i.e., databases, include fields, mapping to destination namespaces i.e., index names in ElasticSearch, etc...
To Exclude fields, run the mongo-connector as follows:
mongo-connector -t http://localhost:9200 -m localhost:27017 -d elastic2_doc_manager -e city,name -n <database_name>.<collection_name>
Mongo-connector also supports excluding nested fields. Use the
following notation to exclude the nested fields:
mongo-connector -t http://localhost:9200 -m localhost:27017 -d elastic2_doc_manager -e address.city,address.geopoint.lat -n <database_name>.<collection_name>
Note: we cannot use both include_fields and exclude_fields with connector because they are mutually exclusive.
Do not prefix the database name and collection name for the exclude fields.