Function replace

It replaces an existing document with the given updated version

It works by discarding the current version and adding the updated one, so it is functionally equivalent to calling discard followed by add. The ID of the updated document should be the same as the original one.

Since it uses discard internally, this method relies on vacuuming to clean up obsolete document references from the index, allowing memory to be released (see discard).

  • Type Parameters

    • ID

      The id type of the documents being indexed.

    • Document

      The type of the documents being indexed.

    • Index extends Record<string, any> = Record<never, never>

      The type of the documents being indexed.

    Parameters

    Returns void