-
Notifications
You must be signed in to change notification settings - Fork 6
Add script support #2
Comments
Just started digging into this. Originally, I was hoping we'd be able to specify an arbitrary ReQL query and pipe the results over to elasticsearch. This might be possible with once rethinkdb/rethinkdb#1118 lands. Until then, I think I've come up with a simpler solution that would fit my use case. First, we need to support script filters so we can manipulate the documents returned by RethinkDB. This appears to be trivial to implement, see the relavent lines from elasticsearch/elasticsearch-river-couchdb. Second, we need to be able to specify table joins in the plugin configuration. Here's a sample configuration introducing both of these concepts: {
"type": "rethinkdb",
"rethinkdb": {
"databases": {
"blog": {
"posts": {
"index": "blog",
"type": "posts",
"joins": [
{
"table": "comments",
"field": "comments",
"left_key": "id",
"right_key": "postId"
}
],
"script": "ctx.doc.comments = ctx.doc.comments.values.length"
}
}
}
}
} In this example we're joining on the table {
"_id": "261f4990-627b-4844-96ed-08b182121c5e",
"_index": "blog",
"_score": 1.0,
"_source": {
"id": "261f4990-627b-4844-96ed-08b182121c5e",
"body": "cupiditate quo est a modi nesciunt soluta\nipsa voluptas",
"title": "at nam consequatur ea labore ea harum",
"userId": 10.0,
"comments": 5
},
"_type": "posts"
} |
Oh, one more thing. It would probably be useful to have a |
Closing since this won't be implemented in the river, but will be easy to do in logstash using LS filters. |
Many rivers support using server scripts:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html
This would be nice to have at some point to allow filtering or joining per discussion in rethinkdb/rethinkdb#1009
The text was updated successfully, but these errors were encountered: