<!-- llms-explorer concept facts · https://llms-explorer.com/tree/index-filters-deprecation-and-migration/ · pack 2026-10-21 · ~983 tokens -->

# Index filters deprecation and migration

> Source-anchored research for Index filters deprecation and migration. Run status: COMPLETED.

Parent: [MongoDB Explain Plans, Query Planner and Plan Cache](https://llms-explorer.com/tree/mongodb-explain-plans-query-planner-and-plan-cache/) · 3 facets · 9 facts · page: https://llms-explorer.com/tree/index-filters-deprecation-and-migration/

## How it works

- Index filters exist only for the server process and disappear after shutdown; MongoDB also says it is difficult to create them on every cluster node. Query settings apply to the query shape across the cluster and persist across restarts. (high confidence) (verified as of 2026-10-20) — [source](https://www.mongodb.com/docs/v8.0/core/query-plans/)
- Neither mechanism guarantees an index scan: index filters only restrict the indexes evaluated and can still yield COLLSCAN, while query-setting indexHints restrict available indexes without forcing the planner to use one. A matching query setting with index hints also takes precedence over command-level index hints. (high confidence) (verified as of 2026-10-20) — [source](https://www.mongodb.com/docs/v8.0/core/query-plans/)

## How-to and procedures

- To recreate an index restriction, define query settings for the corresponding query shape with setQuerySettings and place the namespace and allowed indexes in settings.indexHints. setQuerySettings accepts either a query definition or an existing query-shape hash; inspect saved settings with the $querySettings aggregation stage and verify behavior with explain(). (medium confidence) — [source](https://www.mongodb.com/docs/v8.0/reference/command/setquerysettings/)

## Facts and statements

- MongoDB documents deprecate index filters starting in 8.0 and recommend query settings instead; the same docs say query settings have more functionality, while filters are nonpersistent and difficult to configure on every cluster node. (high confidence) (verified as of 2026-10-21) — [source](https://www.mongodb.com/docs/manual/release-notes/8.0-compatibility.md)
- MongoDB's documented replacement can express index allowlists: setQuerySettings accepts a representative find, distinct, or aggregate command or a query-shape hash, and settings.indexHints.allowedIndexes can list index names or key patterns. Teams can inspect settings with $querySettings and verify them in explain output. (high confidence) (verified as of 2026-10-20) — [source](https://www.mongodb.com/docs/v8.0/reference/command/setquerysettings/)
- The reviewed MongoDB manuals document planCacheSetFilter and setQuerySettings as separate commands and describe no one-step conversion. I infer that migration requires recreating each filter's intended restriction as a setting for the matching query shape, then validating it with explain. (medium confidence) (verified as of 2026-10-20) — [source](https://www.mongodb.com/docs/v8.0/core/query-plans/)
- MongoDB 8.0 distinguishes the legacy plan-cache query shape used by index filters from the new query shape used by query settings. The old queryHash field is renamed planCacheShapeHash, while the new shape uses queryShapeHash; verify the target queryShapeHash before applying settings by hash after a version or cluster migration. (high confidence) — [source](https://www.mongodb.com/docs/manual/core/query-shapes.md)
- An allowedIndexes setting limits the indexes available to the planner but does not force an index to win; MongoDB may still select a collection scan. Confirm the actual winning plan with explain(). (high confidence) — [source](https://www.mongodb.com/docs/v8.0/reference/command/setquerysettings/)
- Deprecation does not mean planCacheSetFilter was removed in MongoDB 8.0: the versioned manual still documents its syntax and examples while recommending query settings instead. (high confidence) — [source](https://www.mongodb.com/docs/v8.0/reference/command/plancachesetfilter/)
