Jay
Jay

Reputation: 322

Elastic Search Document Level Security

How can I implement elasticsearch document level security, I read the elastic documentation and its not very helpful or at least in my case the scenario is different. This is my scenario, users can upload pictures & documents and it indexed in elasticsearch successfully. For example user1 upload picture named dog1 and user 2 also uploads a picture named dog1. In elasticsearch it indexed both file name as dog1- of course each has its own id. If I retrieve the documents by name 'dog1', it displays both of the pictures. How can I implement if user1 searches for dog1 its displays only his uploaded image? Im using Java to index and retrieve documents from elasticsearch

Upvotes: 0

Views: 374

Answers (1)

gohm'c
gohm'c

Reputation: 15480

Elasticsearch document security is implemented at API level which act like a sentry during document access. In your case the simplest way is add a field to indicate the owner (eg. memberID?) of the picture. When you search, you match altogether using this ID and only return the result that matched this field.

Upvotes: 2

Related Questions