From 1bea4a4a6ccfedd3475743143d2a14d69e44d2da Mon Sep 17 00:00:00 2001
From: Rea Rustagi <85902999+rustagir@users.noreply.github.com>
Date: Mon, 10 Feb 2025 09:46:07 -0500
Subject: [PATCH] Revert "DOCSP-43365: type specification for
createSearchIndex(es)"
---
source/includes/extracts-note.yaml | 2 +-
source/includes/indexes/indexes.php | 40 ++++-------
source/indexes.txt | 5 +-
source/indexes/atlas-search-index.txt | 71 +++++++------------
.../MongoDBCollection-createIndexes.txt | 1 +
.../MongoDBCollection-createSearchIndex.txt | 18 ++---
.../MongoDBCollection-createSearchIndexes.txt | 13 +---
source/whats-new.txt | 7 --
8 files changed, 54 insertions(+), 103 deletions(-)
diff --git a/source/includes/extracts-note.yaml b/source/includes/extracts-note.yaml
index cf8b8480..69346085 100644
--- a/source/includes/extracts-note.yaml
+++ b/source/includes/extracts-note.yaml
@@ -20,7 +20,7 @@ content: |
---
ref: note-atlas-search-async
content: |
- Atlas Search and Vector Search indexes are managed asynchronously. After creating or updating an
+ Atlas Search indexes are managed asynchronously. After creating or updating an
index, you can periodically execute
:phpmethod:`MongoDB\Collection::listSearchIndexes()` and check the
``queryable`` :manual:`output field `
diff --git a/source/includes/indexes/indexes.php b/source/includes/indexes/indexes.php
index f7947e02..3b293fb1 100644
--- a/source/includes/indexes/indexes.php
+++ b/source/includes/indexes/indexes.php
@@ -57,48 +57,36 @@
// end-index-array-query
// start-create-search-index
-$searchIndexName = $collection->createSearchIndex(
+$indexName = $collection->createSearchIndex(
['mappings' => ['dynamic' => true]],
['name' => 'mySearchIdx']
);
// end-create-search-index
-// start-create-vector-index
-$vectorSearchIndexName = $collection->createSearchIndex(
- [
- 'fields' => [[
- 'type' => 'vector',
- 'path' => 'plot_embedding',
- 'numDimensions' => 1536,
- 'similarity' => 'dotProduct'
- ]]
- ],
- ['name' => 'myVSidx', 'type' => 'vectorSearch']
-);
-// end-create-vector-index
-
-// start-create-multiple-indexes
+// start-create-search-indexes
$indexNames = $collection->createSearchIndexes(
[
[
- 'name' => 'SearchIdx',
+ 'name' => 'SearchIdx_dynamic',
'definition' => ['mappings' => ['dynamic' => true]],
],
[
- 'name' => 'VSidx',
- 'type' => 'vectorSearch',
+ 'name' => 'SearchIdx_simple',
'definition' => [
- 'fields' => [[
- 'type' => 'vector',
- 'path' => 'plot_embedding',
- 'numDimensions' => 1536,
- 'similarity' => 'dotProduct'
- ]]
+ 'mappings' => [
+ 'dynamic' => false,
+ 'fields' => [
+ 'title' => [
+ 'type' => 'string',
+ 'analyzer' => 'lucene.simple'
+ ]
+ ]
+ ]
],
],
]
);
-// end-create-multiple-indexes
+// end-create-search-indexes
// start-list-search-indexes
foreach ($collection->listSearchIndexes() as $indexInfo) {
diff --git a/source/indexes.txt b/source/indexes.txt
index dfe80727..29afd6ed 100644
--- a/source/indexes.txt
+++ b/source/indexes.txt
@@ -229,10 +229,9 @@ Atlas Search Index Management
-----------------------------
The following sections contain code examples that describe how to manage
-:atlas:`Atlas Search ` and :atlas:`Vector
-Search ` indexes.
+:atlas:`Atlas Search indexes `.
-.. note:: Atlas Search and Vector Search Index Management is Asynchronous
+.. note:: Atlas Search Index Management is Asynchronous
The {+php-library+} manages Atlas Search indexes asynchronously. The
library methods described in the following sections return the server
diff --git a/source/indexes/atlas-search-index.txt b/source/indexes/atlas-search-index.txt
index c3d8fce4..eb8762aa 100644
--- a/source/indexes/atlas-search-index.txt
+++ b/source/indexes/atlas-search-index.txt
@@ -20,19 +20,16 @@ Atlas Search Indexes
Overview
--------
-In this guide, you can learn how to programmatically manage your Atlas
-Search and Atlas Vector Search indexes by using the {+library-short+}.
+The MongoDB Atlas Search feature enables you to perform full-text
+searches on collections hosted on Atlas. Before you can perform Atlas
+Search queries, you must create indexes that specify which
+fields to index and how they are indexed.
-The Atlas Search feature enables you to perform full-text searches on
-collections hosted on MongoDB Atlas. To learn more about Atlas Search,
-see the :atlas:`Atlas Search Overview `.
-
-Atlas Vector Search enables you to perform semantic searches on vector
-embeddings stored in MongoDB Atlas. To learn more about Atlas Vector Search,
-see the :atlas:`Atlas Vector Search Overview `.
+To learn more about Atlas Search, see the :atlas:`Atlas Search Overview
+`.
You can use the following methods on a ``MongoDB\Collection`` instance
-to manage your Atlas Search and Vector Search indexes:
+to manage your Atlas Search indexes:
- ``MongoDB\Collection::createSearchIndex()``
- ``MongoDB\Collection::createSearchIndexes()``
@@ -40,16 +37,15 @@ to manage your Atlas Search and Vector Search indexes:
- ``MongoDB\Collection::updateSearchIndex()``
- ``MongoDB\Collection::dropSearchIndex()``
-.. note:: Atlas Search and Vector Search Index Management is Asynchronous
+.. note:: Atlas Search Index Management is Asynchronous
- The {+php-library+} manages Atlas Search and Vector Search indexes
- asynchronously. The library methods described in the following
- sections return the server response immediately, but the changes to
- your Search indexes take place in the background and might not
- complete until some time later.
+ The {+php-library+} manages Atlas Search indexes asynchronously. The
+ library methods described in the following sections return the server
+ response immediately, but the changes to your Search indexes take
+ place in the background and might not complete until some time later.
The following sections provide code examples that demonstrate how to use
-each of the preceding methods.
+each Atlas Search index management method.
.. _php-atlas-search-index-create:
@@ -57,9 +53,8 @@ Create a Search Index
---------------------
You can use the ``createSearchIndex()`` method to create a single Atlas
-Search or Vector Search index on a collection, or the
-``createSearchIndexes()`` method to create multiple indexes
-simultaneously.
+Search index on a collection, or the ``createSearchIndexes()`` method to
+create multiple indexes simultaneously.
The following code example shows how to create a single Atlas Search
index:
@@ -69,30 +64,17 @@ index:
:start-after: start-create-search-index
:end-before: end-create-search-index
-The following code example shows how to create a single Atlas Vector
-Search index:
-
-.. literalinclude:: /includes/indexes/indexes.php
- :language: php
- :start-after: start-create-vector-index
- :end-before: end-create-vector-index
-
-The following code example shows how to create Atlas Search and
-Vector Search indexes in one call:
+The following code example shows how to create multiple Atlas Search
+indexes:
.. literalinclude:: /includes/indexes/indexes.php
:language: php
- :start-after: start-create-multiple-indexes
- :end-before: end-create-multiple-indexes
-
-After you create Atlas Search or Atlas Vector Search indexes, you can
-perform the corresponding query types on your documents.
+ :start-after: start-create-search-indexes
+ :end-before: end-create-search-indexes
-..
- TODO uncomment when https://github.com/mongodb/docs-php-library/pull/197 is merged
- To learn more, see the following guides:
- - :ref:`php-atlas-search`
- - :ref:`php-vector-search`
+After you create a Search index, you can perform Atlas Search queries on
+your collection. To learn more, see :atlas:`Create and Run Atlas Search
+Queries ` in the Atlas documentation.
.. _php-atlas-search-index-list:
@@ -100,7 +82,7 @@ List Search Indexes
-------------------
You can use the ``listSearchIndexes()`` method to return an array of the
-Atlas Search and Vector Search indexes on a collection:
+Atlas Search indexes on a collection:
.. literalinclude:: /includes/indexes/indexes.php
:language: php
@@ -114,8 +96,9 @@ Update a Search Index
---------------------
You can use the ``updateSearchIndex()``
-method to update an Atlas Search or Vector Search index. You can use this method to
-change the name or configuration of an existing index.
+method to update an Atlas Search index. You can use this method to
+change the name of a Search index or change the configuration of the
+index.
The following code shows how to update a search index to use a simple
analyzer on the ``title`` field:
@@ -132,7 +115,7 @@ Delete a Search Index
---------------------
You can use the ``dropSearchIndex()`` method to remove an Atlas Search
-or Vector Search index from a collection.
+index from a collection.
The following code shows how to delete the Atlas Search index named
``mySearchIdx``:
diff --git a/source/reference/method/MongoDBCollection-createIndexes.txt b/source/reference/method/MongoDBCollection-createIndexes.txt
index 244b3bec..b1f4c7c7 100644
--- a/source/reference/method/MongoDBCollection-createIndexes.txt
+++ b/source/reference/method/MongoDBCollection-createIndexes.txt
@@ -2,6 +2,7 @@
MongoDB\\Collection::createIndexes()
====================================
+
.. contents:: On this page
:local:
:backlinks: none
diff --git a/source/reference/method/MongoDBCollection-createSearchIndex.txt b/source/reference/method/MongoDBCollection-createSearchIndex.txt
index a229a153..840281ec 100644
--- a/source/reference/method/MongoDBCollection-createSearchIndex.txt
+++ b/source/reference/method/MongoDBCollection-createSearchIndex.txt
@@ -4,6 +4,7 @@ MongoDB\\Collection::createSearchIndex()
.. versionadded:: 1.17
+
.. contents:: On this page
:local:
:backlinks: none
@@ -15,7 +16,7 @@ Definition
.. phpmethod:: MongoDB\Collection::createSearchIndex()
- Create an Atlas Search or Vector Search index for the collection.
+ Create an Atlas Search index for the collection.
.. code-block:: php
@@ -50,21 +51,15 @@ Parameters
* - name
- string
- - | Name of the search index to create.
- | You cannot create multiple indexes with the same name on a single
- collection. If you do not specify a name, the default index
- name is ``default``.
+ - Name of the search index to create.
- * - type
- - string
- - Type of index to create. Accepted values are ``'search'`` and
- ``'vectorSearch'``. If you omit this option, the default
- value is ``'search'`` and the method creates an Atlas Search index.
+ You cannot create multiple indexes with the same name on a single
+ collection. If you do not specify a name, the index is named "default".
Return Values
-------------
-The name of the created Atlas Search or Vector Search index as a string.
+The name of the created Atlas Search index as a string.
Errors/Exceptions
-----------------
@@ -115,7 +110,6 @@ See Also
- :phpmethod:`MongoDB\Collection::dropSearchIndex()`
- :phpmethod:`MongoDB\Collection::listSearchIndexes()`
- :phpmethod:`MongoDB\Collection::updateSearchIndex()`
-- :ref:`php-atlas-search-index` guide
- :manual:`createSearchIndexes ` command
reference in the MongoDB manual
- `Atlas Search `__ documentation in the MongoDB Manual
diff --git a/source/reference/method/MongoDBCollection-createSearchIndexes.txt b/source/reference/method/MongoDBCollection-createSearchIndexes.txt
index 6c1b4981..f9124f57 100644
--- a/source/reference/method/MongoDBCollection-createSearchIndexes.txt
+++ b/source/reference/method/MongoDBCollection-createSearchIndexes.txt
@@ -16,7 +16,7 @@ Definition
.. phpmethod:: MongoDB\Collection::createSearchIndexes()
- Create one or more Atlas Search or Vector Search indexes for the collection.
+ Create one or more Atlas Search indexes for the collection.
.. code-block:: php
@@ -39,12 +39,7 @@ Parameters
An optional ``name`` string field specifies the name of the search index to
create. You cannot create multiple indexes with the same name on a single
- collection. If you do not specify a name, the default index name is
- ``default``.
-
- An optional ``type`` string field specifies the type of search index to
- create. Accepted values are ``'search'`` and ``'vectorSearch'``. If
- you do not specify a type, the method creates an Atlas Search index.
+ collection. If you do not specify a name, the index is named "default".
``$options`` : array
An array specifying the desired options.
@@ -64,8 +59,7 @@ Parameters
Return Values
-------------
-The names of the created Atlas Search and Vector Search indexes as an
-array of strings.
+The names of the created Atlas Search indexes as an array of strings.
Errors/Exceptions
-----------------
@@ -123,7 +117,6 @@ See Also
- :phpmethod:`MongoDB\Collection::dropSearchIndex()`
- :phpmethod:`MongoDB\Collection::listSearchIndexes()`
- :phpmethod:`MongoDB\Collection::updateSearchIndex()`
-- :ref:`php-atlas-search-index` guide
- :manual:`createSearchIndexes ` command
reference in the MongoDB manual
- `Atlas Search `__ documentation in the MongoDB Manual
diff --git a/source/whats-new.txt b/source/whats-new.txt
index 656ba387..3b60fb17 100644
--- a/source/whats-new.txt
+++ b/source/whats-new.txt
@@ -164,13 +164,6 @@ improvements, and fixes:
encryption and decryption of the data key locally, ensuring that the
encryption key never leaves the KMIP server.
-- Adds the ``type`` option in Search index specifications for
- the :phpmethod:`MongoDB\Collection::createIndex()` and
- :phpmethod:`MongoDB\Collection::createSearchIndexes()` methods. This
- change allows you to create Atlas Vector Search indexes
- programmatically. To learn more and view examples, see the
- :ref:`php-atlas-search-index` guide.
-
For more information about the changes in this version, see the
:github:`v1.20 release notes
` on GitHub.