========================================
MongoDB\\Collection::updateSearchIndex()
========================================

.. versionadded:: 1.17

.. default-domain:: mongodb

.. contents:: On this page
   :local:
   :backlinks: none
   :depth: 1
   :class: singlecol

Definition
----------

.. phpmethod:: MongoDB\\Collection::updateSearchIndex()

   Update an Atlas Search index for the collection.

   .. code-block:: php

      function updateSearchIndex(string $name, array|object $definition, array $options = []): void

   This method has the following parameters:

   .. include:: /includes/apiargs/MongoDBCollection-method-updateSearchIndex-param.rst

   The ``$options`` parameter supports the following options:

   .. include:: /includes/apiargs/MongoDBCollection-method-updateSearchIndex-option.rst

   .. include:: /includes/extracts/note-atlas-search-requirement.rst
   .. include:: /includes/extracts/note-atlas-search-async.rst

Errors/Exceptions
-----------------

.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst

See Also
--------

- :phpmethod:`MongoDB\\Collection::createSearchIndex()`
- :phpmethod:`MongoDB\\Collection::createSearchIndexes()`
- :phpmethod:`MongoDB\\Collection::dropSearchIndex()`
- :phpmethod:`MongoDB\\Collection::listSearchIndexes()`
- :manual:`updateSearchIndex </reference/command/updateSearchIndex>` command
  reference in the MongoDB manual
- `Atlas Search <https://www.mongodb.com/docs/atlas/atlas-search/>`__ documentation in the MongoDB Manual
