set-security-user.asciidoc 1.6 KB

12345678910111213141516171819202122232425262728
  1. [[set-security-user-processor]]
  2. ==== Pre-processing documents to add security details
  3. // If an index is shared by many small users it makes sense to put all these users
  4. // into the same index. Having a dedicated index or shard per user is wasteful.
  5. // TBD: It's unclear why we're putting users in an index here.
  6. To guarantee that a user reads only their own documents, it makes sense to set up
  7. document level security. In this scenario, each document must have the username
  8. or role name associated with it, so that this information can be used by the
  9. role query for document level security. This is a situation where the
  10. <<ingest-node-set-security-user-processor,set security user processor>> ingest processor can help.
  11. NOTE: Document level security doesn't apply to write APIs. You must use unique
  12. ids for each user that uses the same data stream or index, otherwise they might overwrite other
  13. users' documents. The ingest processor just adds properties for the current
  14. authenticated user to the documents that are being indexed.
  15. The <<ingest-node-set-security-user-processor,set security user processor>> attaches user-related details (such as
  16. `username`, `roles`, `email`, `full_name` and `metadata` ) from the current
  17. authenticated user to the current document by pre-processing the ingest. When
  18. you index data with an ingest pipeline, user details are automatically attached
  19. to the document. If the authenticating credential is an API key, the API key
  20. `id`, `name` and `metadata` (if it exists and is non-empty) are also attached to
  21. the document.
  22. For more information see <<ingest>> and
  23. <<ingest-node-set-security-user-processor>>