SearchIndexClient.CreateOrUpdateIndex Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates a new search index or updates an existing index.
public virtual Azure.Response<Azure.Search.Documents.Indexes.Models.SearchIndex> CreateOrUpdateIndex (Azure.Search.Documents.Indexes.Models.SearchIndex index, bool allowIndexDowntime = false, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateOrUpdateIndex : Azure.Search.Documents.Indexes.Models.SearchIndex * bool * bool * System.Threading.CancellationToken -> Azure.Response<Azure.Search.Documents.Indexes.Models.SearchIndex>
override this.CreateOrUpdateIndex : Azure.Search.Documents.Indexes.Models.SearchIndex * bool * bool * System.Threading.CancellationToken -> Azure.Response<Azure.Search.Documents.Indexes.Models.SearchIndex>
Public Overridable Function CreateOrUpdateIndex (index As SearchIndex, Optional allowIndexDowntime As Boolean = false, Optional onlyIfUnchanged As Boolean = false, Optional cancellationToken As CancellationToken = Nothing) As Response(Of SearchIndex)
Parameters
- index
- SearchIndex
Required. The SearchIndex to create or update.
- allowIndexDowntime
- Boolean
Optional value indicating whether to allow analyzers, tokenizers, token filters, or character filters to be added to the index by temporarily taking the index offline for a few seconds. The default is false. This temporarily causes indexing and queries to fail. Performance and write availability of the index can be impaired for several minutes after the index is updated, or longer for very large indexes.
- onlyIfUnchanged
- Boolean
True to throw a RequestFailedException if the ETag does not match the current service version; otherwise, the current service version will be overwritten.
- cancellationToken
- CancellationToken
Optional CancellationToken to propagate notifications that the operation should be canceled.
Returns
The Response<T> from the server containing the SearchIndex that was created or updated. This may differ slightly from what was passed in since the service may return back fields set to their default values depending on the field type and other properties.
Exceptions
Thrown when index
is null.
Thrown when a failure is returned by the Search service.