Every field you add to a search index makes that index bigger, slower to build, and slower to query — even fields nobody ever actually searches by. It's tempting to index "everything, just in case" when setting up a Search API index for the first time; this lesson is about resisting that instinct and indexing deliberately.
What you'll learn in this lesson
- Why every indexed field has a real, ongoing cost
- Auditing which fields your search UI actually queries or displays
- The difference between indexed and stored fields, and why it matters
The cost of an unused indexed field
Each field you add to an index configuration (/admin/config/search/search-api/index/{index}/fields) increases the size of every single index entry, the time it takes to index each item, and — for full-text fields specifically — the size of the inverted index structures covered in the Solr lesson. A field indexed but never actually used in any search query or facet is pure overhead with zero corresponding benefit.
Auditing what's actually used
// Check what your search view/page actually filters or sorts on —
// those are the fields that genuinely need to be indexed. Everything
// else on the index configuration screen is a candidate to remove.
$index = \Drupal\search_api\Entity\Index::load('default_index');
foreach ($index->getFields() as $field_id => $field) {
// Cross-reference $field_id against your actual Views search
// exposed filters, sort criteria, and displayed result fields.
}
A practical audit: open your search results View's configuration and list every field it actually filters, sorts, or displays. Anything on the index that isn't in that list is a genuine candidate for removal — it was likely added "just in case" when the index was first set up and never revisited.
Quick check: a field is currently both indexed and stored, but your search View only ever displays its value in results — never filters or sorts by it. What's the safe trim? If you said keep it stored, remove the indexed/full-text setting, you've correctly separated the two costs this lesson distinguishes.
Key takeaways
- Every indexed field adds real cost to index size, indexing time, and query time — "just in case" indexing has a genuine ongoing price.
- Audit your actual search UI's filters, sorts, and displayed fields to find which index fields are genuinely used versus vestigial.
- Indexed and stored are separate settings with separate costs and purposes — trim each independently based on actual use.
- Revisit index field configuration periodically, especially after a search UI redesign that may have stopped using fields still configured on the index.
Coming up next
You've now covered the complete search-performance toolkit — indexing, query caching, backend choice, and field discipline. Next, we turn to a different kind of query entirely: optimizing REST and JSON:API responses for headless and API-driven Drupal.