索引类型。从KeystoneJS到弹性搜索的关系值

时间:2016-03-10 11:33:42

标签: elasticsearch mongoose keystonejs mongoosastic

我是KeystoneJs的新手,我想使用mongoosastic索引elasticsearch中的Type.Relationship。问题出在Mongo数据Type.Relationship存储为ObjectID数组 - 而不是实际关系的值 - 因为每个数据可能有多个(请参阅下面的categoriesplatform < / p>

{
    "_id" : ObjectId("56d49e8ebe469b9614119259"),
    "slug" : "philips-hue",
    "title" : "Philips Hue",
    "categories" : [ 
        ObjectId("56d4a03abe469b961411925a"), 
        ObjectId("56d4a047be469b961411925b")
    ],
    "state" : "published",
    "__v" : 3,
    "author" : ObjectId("56d499ad995a533813adef63"),
    "publishedDate" : ISODate("2016-02-29T13:00:00.000Z"),
    "manufacturer" : ObjectId("56d5eeec1ffcbb0517f07e1b"),
    "platform" : [ 
        ObjectId("56d5ee0ab85dbdf916007009"), 
        ObjectId("56d5ee37b85dbdf91600700a"),
        ObjectId("56d5ee34uj3i223io23h2394")
    ]
}

这些ObjectId platform的格式为:

{
    "_id" : ObjectId("56d5ee0ab85dbdf916007009"),
    "key" : "homekit",
    "name" : "Homekit",
    "__v" : 0
}

有人能把我放在正确的路径上添加到引用的ObjectIds的弹性搜索索引name吗?

0 个答案:

没有答案