---
title: "Discussion on \"Your search index is a second copy of your data, so it needs the same permissions\" | Hashnode"
description: "Discussion on \"Your search index is a second copy of your data, so it needs the same permissions\". A common pattern: the app checks permissions carefully on every detail page, then adds search later. Documents, tickets or messages get pushed into a search index, and the search endpoint returns what"
url: "https://hashnode.com/posts/your-search-index-is-a-second-copy-of-your-data-so-it-needs-the-same-permissions/6ac37f0190b64893480a7d75"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Your search index is a second copy of your data, so it needs the same permissions](https://authbyexample.hashnode.dev/your-search-index-is-a-second-copy-of-your-data-so-it-needs-the-same-permissions?utm_source=hashnode&utm_medium=feed)

A common pattern: the app checks permissions carefully on every detail page, then adds search later. Documents, tickets or messages get pushed into a search index, and the search endpoint returns what

Oct 5 · 2 min read · authbyexample.hashnode.dev  
Read the article

-   [#security](https://hashnode.com/tag/security)
-   [#authorization](https://hashnode.com/tag/authorization)
-   [#search](https://hashnode.com/tag/search)
-   [#webdev](https://hashnode.com/tag/webdev)

## Written by

[Auth By Example](https://hashnode.com/@authbyexample)

@authbyexample

  
[View profile](https://hashnode.com/@authbyexample)

Practical lessons on auth, authorization, and access control.

Practical lessons on auth, authorization, and access control.

## Responses 2

Markdown supported · ⌘↵ to post

[indiainfranotes](https://hashnode.com/@indiainfranotes)

[Oct 5](https://hashnode.com/posts/your-search-index-is-a-second-copy-of-your-data-so-it-needs-the-same-permissions/6ac37f0190b64893480a7d75/comment/6ac3bf6f66d611214b3dea65)

The same trap shows up with deletion: a record removed from the main database often lives on in the search index, snippets and autocomplete for days because nobody wired up the delete event. Treating the index as a second copy means it needs the same retention and erasure rules, not just the same read checks. Do you filter by permission at query time, or bake ACLs into each indexed document and reindex when access changes?

iin1005h20

[Auth By Example](https://hashnode.com/@authbyexample)

[Oct 6](https://hashnode.com/posts/your-search-index-is-a-second-copy-of-your-data-so-it-needs-the-same-permissions/6ac37f0190b64893480a7d75/comment/6ac3bf6f66d611214b3dea65#reply-6ac4c363509f2d9f868b8c21)

Good point on deletion. Deletes and permission changes both need to reach the index, or old snippets keep showing up in autocomplete. I'd do both: store the ACL fields (tenant, owner, group IDs) on each document so the search engine can filter cheaply, then re-check the top results against the live permission check before returning them. That way a stale index entry gets dropped even if the reindex after an access change hasn't run yet.
