Table of Contents

Enum StringSearchIndexAmount

Namespace
MongoDB.EntityFrameworkCore.Metadata.Search
Assembly
MongoDB.EntityFrameworkCore.dll

Controls how much term information MongoDB search stores for a string field.

public enum StringSearchIndexAmount

Fields

Docs = 0

Store only the list of documents that contain each term (no frequencies, positions, or offsets). Use for basic term existence queries and filtering with minimal index size; limits scoring and disables phrase/proximity queries and accurate highlighting.

Freqs = 1

Store document lists plus per‑document term frequencies. Enables better relevance scoring based on term frequency while keeping index overhead lower than positions/offsets.

Positions = 2

Store document lists, term frequencies, and token positions. Required for phrase and proximity queries (e.g., slop) and improves certain analyzers’ behaviors; increases index size.

Offsets = 3

Store document lists, term frequencies, positions, and character offsets. Required for precise text highlighting/snippet generation and some span queries; largest index footprint.

Remarks

This setting maps to the underlying Lucene postings detail (also known as indexOptions), trading index size for richer query features and scoring. Higher levels include the data from lower levels:

  • Docs: documents that contain each term.
  • Freqs: + term frequencies for better scoring.
  • Positions: + token positions for phrase and proximity queries.
  • Offsets: + character offsets for precise highlighting/snippets.
Choose the smallest amount that enables the queries you need to reduce index size and build time. For background and recommended defaults, see Atlas Search string field options: https://www.mongodb.com/docs/atlas/atlas-search/field-types/string/.