2015-04-21 42 views

回答

1

設置mongodb河時,您可以排除某些域,例如

"mongodb": { 
     "db": "YourDbName", 
     "collection": "YourCollectionName", 
     "options": { 
       "exclude_fields": "name_of_field_to_be_ignored" 
      } 
    }, 
+0

感謝。如果有像(a,b,c)這樣的字段,那麼使用「exclude_fields」:「a,b,c」或「exclude_fields」:[「a」,「b」,「c」],這是否正確? – navins

+0

列表是你的答案: [ES River MongoDB示例](https://github.com/richardwilly98/elasticsearch-river-mongodb/blob/master/manual-testing/issues/76/mongodb-river-simple.json) – Jovik

0

我從河蒙戈維基獲得另一種方法。通過使用腳本,您可以自定義..但是,您應該在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" 
    } 
}'