我已经安装了连接mongodb和elasticsearch的elasticsearch river(使用this插件)。我为mongodb定义了某种架构,为elasticsearch定义了某种映射。
我找不到关于如何从河中排除mongodb中的字段的任何信息。我认为最可行的方法是将这些字段的Elasticsearch映射修改为store:no,index:not_analyzed,include_in_all:false
。
我仍然不清楚使用上述解决方案是否完全避免了任何处理,因为理论上所有json提交也都存储在_source中。
有人对此有任何建议吗?
最佳答案
是的,您可以在mongo-river中进行。您需要在河流 map 中指定排除字段。.我已附加了示例代码..将其 checkout 。
curl -XPUT 'http://IP:9200/_river/mongodb/_meta' -d '{
"type": "mongodb",
"mongodb": {
"db": "DATABASE_NAME",
"collection": "COLLECTION",
"gridfs": true
}, "options": {
"secondary_read_preference" : true,
"drop_collection": ${mongo.drop.collection},
"exclude_fields": ${mongo.exclude.fields},
"include_fields": ${mongo.include.fields},
"include_collection": ${mongo.include.collection},
"import_all_collections": ${mongo.import.all.collections},
"initial_timestamp": {
"script_type": ${mongo.initial.timestamp.script.type},
"script": ${mongo.initial.timestamp.script}
},
"skip_initial_import" : ${mongo.skip.initial.import},
"store_statistics" : ${mongo.store.statistics},
},
"index": {
"name": "ES_INDEX_NAME",
"type": "ES_TYPE_NAME"
}
}'
有关更多信息,请引用:
https://github.com/richardwilly98/elasticsearch-river-mongodb/wiki
希望能帮助到你..!
关于mongodb - 从Elasticsearch河进口中排除mongodb字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22383387/