Agent Wranglers

DAT-62Recommended

Index only the fields people search

Keep a written list of the fields each search index holds, and leave out every field nobody searches. Delete a record's index entry in the same job that deletes or erases the record.

How to do it

A separate index is a copy, as Name the source of truth says. Every copied field is one more place to erase. Store the record ID, the account ID and the searchable text. Load the fields you show from the database by ID after the search, which also returns current values. Keep secrets and personal data such as phone numbers, addresses and birth dates out of the index unless people search by them. List each index in the data map. Call its delete from the one delete function in Let people see and delete their data. Updates reach the index as Keep search indexes in step describes.

How to check

A test compares the fields in each index's mapping or schema with the written list and fails on any extra field. Erase a test person, then search every index for their email and name. Each search returns 0 documents.

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/data/search/search-index-fields">Agent Wranglers data playbook</a>. In code you write, add a comment next to it with the same link.