Aliases - Create Or Update
Creates a new search alias or updates an alias if it already exists.
PUT {endpoint}/aliases('{aliasName}')?api-version=2025-03-01-preview
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
alias
|
path | True |
string |
The definition of the alias to create or update. |
|
endpoint
|
path | True |
string |
The endpoint URL of the search service. |
|
api-version
|
query | True |
string |
Client Api Version. |
Request Header
| Name | Required | Type | Description |
|---|---|---|---|
| x-ms-client-request-id |
string (uuid) |
The tracking ID sent with the request to help with debugging. |
|
| If-Match |
string |
Defines the If-Match condition. The operation will be performed only if the ETag on the server matches this value. |
|
| If-None-Match |
string |
Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. |
|
| Prefer | True |
string |
For HTTP PUT requests, instructs the service to return the created/updated resource on success. |
Request Body
| Name | Required | Type | Description |
|---|---|---|---|
| indexes | True |
string[] |
The name of the index this alias maps to. Only one index name may be specified. |
| name | True |
string |
The name of the alias. |
| @odata.etag |
string |
The ETag of the alias. |
Responses
| Name | Type | Description |
|---|---|---|
| 200 OK | ||
| 201 Created | ||
| Other Status Codes |
Error response. |
Examples
SearchServiceCreateOrUpdateAlias
Sample request
PUT https://previewexampleservice.search.windows.net/aliases('myalias')?api-version=2025-03-01-preview
{
"name": "myalias",
"indexes": [
"preview-test"
],
"@odata.etag": "0x1234568AE7E58A1"
}
Sample response
{
"name": "myalias",
"indexes": [
"preview-test"
]
}
{
"name": "myalias",
"indexes": [
"preview-test"
]
}
Definitions
| Name | Description |
|---|---|
|
Error |
The resource management error additional info. |
|
Error |
The error detail. |
|
Error |
Error response |
|
Search |
Represents an index alias, which describes a mapping from the alias name to an index. The alias name can be used in place of the index name for supported operations. |
ErrorAdditionalInfo
The resource management error additional info.
| Name | Type | Description |
|---|---|---|
| info |
object |
The additional info. |
| type |
string |
The additional info type. |
ErrorDetail
The error detail.
| Name | Type | Description |
|---|---|---|
| additionalInfo |
The error additional info. |
|
| code |
string |
The error code. |
| details |
The error details. |
|
| message |
string |
The error message. |
| target |
string |
The error target. |
ErrorResponse
Error response
| Name | Type | Description |
|---|---|---|
| error |
The error object. |
SearchAlias
Represents an index alias, which describes a mapping from the alias name to an index. The alias name can be used in place of the index name for supported operations.
| Name | Type | Description |
|---|---|---|
| @odata.etag |
string |
The ETag of the alias. |
| indexes |
string[] |
The name of the index this alias maps to. Only one index name may be specified. |
| name |
string |
The name of the alias. |