1

Mongo DB provides a connector to integrate the data from Mongo database to targets like Solr, ElasticSearch. I am using this connector to move data from Mongo Collection from a particular database to ElasticSearch index.

How can I exclude the specified fields while loading data from Mongo database to index in ElasticSearch?.

1
  • This question talks about exclude fields where as referenced question talks about include fields and mapping. I found very difficult to figure out the solution for excluding fields. So to help others I created this question specially on excluding fields. Commented Jun 6, 2017 at 8:06

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Was the whole point of this to be a self answer? Can you please not type everything in bold? It's very disconcerting and feels like someone is poking me in the forehead.
Sorry for that, I posted this question to help others. The mongo-connector documentation is not provided examples to exclude the fields.
Maybe not. But there are also other answers here already for both elastic search and solr.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.