Many to many relationships

Our application is based on the following model Project -> Workbooks ->
Content

Users can have many Projects and many Workbooks. Users can Invite other
users to collaborate on their Projects/Workbooks.

I would like setup elasticsearch in way that it allows users to search for
any content within the Projects/workbook they have created or have
subscribed to.

What is the best practice to restrict search results to a specific user or
model elastic search to enforce this?

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Basically, I would say: add in your workbook/project all users that can have an access (array of users). It means update all projects/workbooks each a user grant rights to another one.

Does it help?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 21 juin 2013 à 22:42, Simran Butalia sbutalia@gmail.com a écrit :

Our application is based on the following model Project -> Workbooks -> Content

Users can have many Projects and many Workbooks. Users can Invite other users to collaborate on their Projects/Workbooks.

I would like setup elasticsearch in way that it allows users to search for any content within the Projects/workbook they have created or have subscribed to.

What is the best practice to restrict search results to a specific user or model elastic search to enforce this?

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Getting all projects a user has subscribed to:

curl localhost:9200/projects/_search -d '{
"query" : {
"constant_score" : {
"filter" : {
"in" : { "user_id" : ["<user_id>"] }
}
}
}
}'

Getting all users for a project:

curl localhost:9200/users/_search -d '{
"query" : {
"constant_score" : {
"filter" : {
"in" : { "project_id" : ["<project_id>"] }
}
}
}
}'