简体   繁体   中英

Elastic Search - Results based on users properties

What are the recommendation when it comes to indexing with Elastic Search that needs to be served based on complex user context. For example a product visibility might be restricted for certain sellers and categories or both. How should the data be modeled?

Instead of implementing the read restrictions in your data model, you could set up document and field restrictions for user roles . Assume that certain sellers get organized in a role named sellers_A . You could then restrict the documents and fields that the users correlating to that role can access (read) from a particular index.

See https://www.elastic.co/guide/en/elasticsearch/reference/current/field-and-document-access-control.html for how to set up field level and document security.

The advantage of it is that your data model does not get touched at all. Furthermore, you can simply update the access on a per-role basis in the future instead of constantly update your data model (which would require reindexing etc.).

Im aware that my answer does not strictly focus on the data model aspect. But in my opinion the field and document level restrictions provide a very good mechanism to achieve your requirements (of course not knowing all the details of your use case).

I hope I could help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM