richardwilly98 / elasticsearch-river-mongodb

MongoDB River Plugin for ElasticSearch
1.12k stars 215 forks source link

Mongo dbref expansion #525

Open mcleae opened 9 years ago

mcleae commented 9 years ago

expand and nest dbrefs instead of mapping them as just the id and type

The following (where category is a dbref)

 {
      "_id" : "51a220fdb573df1144000000",
      "_source":{
          "body":"the body",
          "category":{"ref":"category","id":"5194272cfdea65e5d6000021"}
          }
      }
  }

Becomes

 {
      "_id" : "51a220fdb573df1144000000",
      "_source":{
          "body":"the body",
          "category":{
            "_id":"5194272cfdea65e5d6000021",
            "name":"arbitrary category for a thousand"
          }
      }
  }
benmccann commented 9 years ago

I'm not particularly excited about this feature. MongoDB recommends against using DBRefs

mcleae commented 9 years ago

the feature is already in this plugin, this just changes it to expand and nest the referenced doc. if dbrefs aren't used then this has no effect, if they are then it will at least result in a nested searchable document in elasticsearch, which is in line with mongo's recommendation of nesting the related data

mcleae commented 9 years ago

i just noticed this https://github.com/richardwilly98/elasticsearch-river-mongodb/issues/350. if the preference is to have a config for enabling/disabling fetching i can take care of that. i'll aim to leave it disabled by default so as to preserve the current functionality

mcleae commented 9 years ago

@benmccann configs for enabling/disabling are in, please let me know if you have any other concerns