我使用河蒙戈将mongodb集合绑定到弹性搜索。
这将导致在每个领域的芒果采集将保存在弹性指数。
我想知道如何忽略一些字段,不要让它保存在弹性指数中。
发布于 2015-04-22 08:56:50
在设置mongodb时,可以排除某些字段。
"mongodb": {
"db": "YourDbName",
"collection": "YourCollectionName",
"options": {
"exclude_fields": "name_of_field_to_be_ignored"
}
},发布于 2015-04-22 09:12:07
我从蒙哥维基河上得到了另一种方法。通过使用脚本,您可以使用customize..However,您应该在elasticsearch.yml中将禁用脚本设置为false。
https://github.com/richardwilly98/elasticsearch-river-mongodb/wiki
$ curl -XPUT "localhost:9200/_river/mongoscriptfilter/_meta" -d'
{
"type": "mongodb",
"mongodb": {
"db": "testmongo",
"collection": "documents",
"script": "ctx.document.title = ctx.document.title_from_mongo; delete ctx.document.title_from_mongo;"
},
"index": {
"name": "testmongo",
"type": "documents"
}
}'https://stackoverflow.com/questions/29773472
复制相似问题