For AI agents: a documentation index is available at https://www.mongodb.com/ja-jp/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

Text Index Versions on Self-Managed Deployments

Note

MongoDB offers an improved full-text search solution, MongoDB Search, and vector search solution, MongoDB Vector Search. We recommend using MongoDB Search indexes or MongoDB Vector Search indexes instead of text indexes.

Text indexes are available in the following versions:

Text Index Version
Description

Version 3

MongoDB 3.2 introduces version 3 of text indexes. Version 3 is the default version for text indexes created in MongoDB 3.2 and later.

Version 2

MongoDB 2.6 introduces version 2 of text indexes. Version 2 is the default version for text indexes created in MongoDB 2.6 to 3.0.

Version 1

MongoDB 2.4 introduces version 1 of text indexes. MongoDB 2.4 only supports version 1.

Important

Always use the default index version when possible. Only override the default version if required for compatibility reasons.

To override the default version and specify a different version for your text index, set the textIndexVersion option when you create an index:

db.<collection>.createIndex(
{ <field>: "text" },
{ "textIndexVersion": <version> }
)

The following command creates a version 2 text index on the content field:

db.test.createIndex(
{ "content": "text" },
{ "textIndexVersion": 2 }
)
Rate this page