River MongoDB->Elasticsearch (parent/child)

Hello,

I'm looking for a solution to creat parent/child relation with the script
of the river mongodb->ES plugine.

I don't know if the relation parent/child must be present already in
MongoDB to do that. For now, I just have the field "parent_id" in the all
document with an ID which is the same between the parent and children. The
type (parent or child) is in the field "estype" to dispatch them in their
right type.

My mapping :

POST mongo_index_log
{
"mappings": {
"parent": {},
"child": {
"_parent": {"type": "parent"}
}
},
"settings": {
"number_of_shards": 1,
"number_of_replica": 0
}
}

My river :

PUT _river/mongo_index_log/_meta
{
"type": "mongodb",
"mongodb": {
"servers": [
{ "host": "127.0.0.1", "port": 27017 }
],
"options": { "secondary_read_preference": true },
"db": "test",
"collection": "mongodb_base",
"script": "ctx._type = ctx.document.estype; if (ctx._type == 'fils') {
ctx._parent = ctx.document.parent_id; }"
},
"index": {
"name": "mongo_index_log",
"type": "mongo_type"
}
}

In this case, the split into the right type is ok, but the relarion
parent/child doesn't do anything when I put the following command : (and
i'm waiting for the parent who have at least 1 child)

POST mongo_index_log/parent/_search
{
"query": {
"bool": {
"must": [
{
"top_children": {
"type": "child",
"query": {
"match_all": {}
}
}
}
]
}
}
}

Also, i tried changing the "_id" of the parent like that :

"script": "ctx._type = ctx.document.estype; if (ctx._type == 'fils') {
ctx._parent = ctx.document.parent_id; } else { ctx._id =
ctx.document.parent_id; } "

But in this case, the split in the right type doe'nt works et so the
relation parent/child neither.

Any ideas ? I found on this link, but nothing about my problems :
https://github.com/richardwilly98/elasticsearch-river-mongodb/tree/master/manual-testing/issues/64

Have a good day,

--
Ludovic M

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/fba13a13-afaa-464f-ad82-b57c8e86197b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.