> For the complete documentation index, see [llms.txt](https://docs.percona.com/percona-search-for-mongodb/llms.txt).

# Search Indexes

A search index is a data structure that maps the terms in your documents to the documents that contain them. Instead of scanning every document in a collection, a search query looks up terms in the index and retrieves only the matching documents, along with metadata such as term positions and relevance data.

- Search Indexes are maintained by the `mongot` process using Apache Lucene.
- Search queries use the aggregation pipeline stages `$search` and `$searchMeta`.
- When you create a search index, Percona Search for MongoDB transforms your data into a sequence of tokens or terms.

## How Search Indexes work

When you create a search index on a collection, `mongot` does the following:

1. Performs an initial sync, reading the collection data from mongod and building the Lucene index.
1. Opens a change stream on the collection to watch for inserts, updates, and deletes.
1. Applies those changes to the index continuously, keeping it in sync with the collection.

## Types of Search Indexes

Percona Search for MongoDB supports two index types:

- Search indexes power full-text search with the `$search` and `$searchMeta` stages. They support text analyzers, relevance-based scoring, autocomplete, faceting, and highlighting.
- Vector search indexes power semantic and similarity search with the `$vectorSearch` stage. They index vector embeddings that you store in your documents and support [approximate nearest neighbor (ANN)](https://www.mongodb.com/resources/basics/ann-search) search.

## Field mappings

A search index definition specifies which fields to index and how to index them. You can choose between two mapping strategies:

- [Dynamic mapping](https://www.mongodb.com/docs/search/index/define-field-mappings/#dynamic-mappings) indexes all fields of supported types automatically, including fields added to documents later. Fields can be indexed based on the default set of types or by configuring a `typeSet`.
- [Static mapping](https://www.mongodb.com/docs/search/index/define-field-mappings/#static-mappings) indexes only the fields you explicitly define. To use static mappings to configure index options for only some fields, set `mappings.dynamic` to false and specify the field name, [data type](https://www.mongodb.com/docs/search/index/define-field-mappings/#mongodb-search-field-types) , and other configuration options for each field that you want to index. You can specify the fields in any order.

## Next steps

[Create a search index](https://docs.percona.com/percona-search-for-mongodb/create-search-index.md)

[Update a search index](https://docs.percona.com/percona-search-for-mongodb/update-search-index.md)

[Delete a search index](https://docs.percona.com/percona-search-for-mongodb/delete-search-index.md)
