Skip to content

Commit 9791a7f

Browse files
Merge pull request #280040 from HeidiSteen/heidist-june28
[azure search] Example for index updates
2 parents bedac54 + 91bcd79 commit 9791a7f

File tree

4 files changed

+59
-24
lines changed

4 files changed

+59
-24
lines changed

articles/search/search-howto-reindex.md

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ ms.date: 07/01/2024
1414

1515
# Update or rebuild an index in Azure AI Search
1616

17-
This article explains how to update an existing index in Azure AI Search with incremental indexing. It explains the circumstances under which rebuilds are required, and provides recommendations for mitigating the effects of rebuilds on ongoing query requests.
17+
This article explains how to update an existing index in Azure AI Search with schema changes or content changes through incremental indexing. It explains the circumstances under which rebuilds are required, and provides recommendations for mitigating the effects of rebuilds on ongoing query requests.
1818

1919
During active development, it's common to drop and rebuild indexes when you're iterating over index design. Most developers work with a small representative sample of their data so that reindexing goes faster.
2020

21-
For applications already in production, we recommend creating a new index that runs side by side an existing index to avoid query downtime and using an [index alias](search-how-to-alias.md) to avoid changing your application code.
21+
For schema changes on applications already in production, we recommend creating and testing a new index that runs side by side an existing index. Use an [index alias](search-how-to-alias.md) to swap in the new index while avoiding changes your application code.
2222

2323
## Update content
2424

25-
Incremental indexing and synchronizing an index against changes in source data is a basic requirement for most search applications. This section explains the workflow for overwriting field contents in a search index.
25+
Incremental indexing and synchronizing an index against changes in source data is fundamental to most search applications. This section explains the workflow for updating field contents in a search index.
2626

27-
1. Use the same techniques for loading documents: [Documents - Index (REST)](/rest/api/searchservice/documents) or an equivalent API in the Azure SDKs. For more information about indexing, see [Load documents](search-how-to-load-search-index.md).
27+
1. Use the same techniques for loading documents: [Documents - Index (REST)](/rest/api/searchservice/documents) or an equivalent API in the Azure SDKs. For more information about indexing techniques, see [Load documents](search-how-to-load-search-index.md).
2828

2929
1. Set the `@search.action` parameter to determine the effect on existing documents:
3030

@@ -41,13 +41,47 @@ Queries continue to run, but if you're updating or removing existing fields, you
4141

4242
## Tips for incremental indexing
4343

44-
+ Use `mergeOrUpload` as the search action.
44+
+ [Indexers automate incremental indexing](search-indexer-overview.md). If you can use an indexer, and if the data source supports change tracking, you can run the indexer on a recurring schedule to add, update, or overwrite searchable content so that it's synchronized to your external data.
4545

46-
+ The payload must include the keys or identifiers of every document you want to add, update, or delete.
46+
+ If you're making index calls directly, use `mergeOrUpload` as the search action.
4747

48-
+ For merging, avoid listing fields that contain content you want to preserve. For example, if you populated vector fields, but only need to update a few nonvector fields, the payload should list just those fields you want to update. Specifying an empty field overwrites the existing value with a null value.
48+
+ The payload must include the keys or identifiers of every document you want to add, update, or delete.
4949

50-
+ [Indexers automate incremental indexing](search-indexer-overview.md). If you can use an indexer, and if the data source supports change tracking, you can run the indexer on a recurring schedule to add, update, and delete an index so that it's synchronized to your external data.
50+
+ To update the contents of simple fields and subfields in complex types, list only the fields you want to change. For example, if you only need to update a description field, the payload should consist of the document key and the modified description. Omitting other fields retains their existing values.
51+
52+
+ To merge the inline changes into string collection, provide the entire value. Recall the `tags` field example from the previous section. New values overwrite the old values, and there's no merging at the field content level.
53+
54+
Here's a [REST API example](search-get-started-rest.md) demonstrating these tips:
55+
56+
```rest
57+
### Get Secret Point Hotel by ID
58+
GET {{baseUrl}}/indexes/hotels-vector-quickstart/docs('1')?api-version=2023-11-01 HTTP/1.1
59+
Content-Type: application/json
60+
api-key: {{apiKey}}
61+
62+
### Change the description and city for Secret Point Hotel
63+
POST {{baseUrl}}/indexes/hotels-vector-quickstart/docs/search.index?api-version=2023-11-01 HTTP/1.1
64+
Content-Type: application/json
65+
api-key: {{apiKey}}
66+
67+
{
68+
"value": [
69+
{
70+
"@search.action": "mergeOrUpload",
71+
"HotelId": "1",
72+
"Description": "Change the description and city for Secret Point Hotel. Keep everything else."
73+
"Address": {
74+
"City": "Miami"
75+
}
76+
}
77+
]
78+
}
79+
80+
### Retrieve the same document, confirm the overwrites and retention of all other values
81+
GET {{baseUrl}}/indexes/hotels-vector-quickstart/docs('1')?api-version=2023-11-01 HTTP/1.1
82+
Content-Type: application/json
83+
api-key: {{apiKey}}
84+
```
5185

5286
## Change an index schema
5387

@@ -123,7 +157,7 @@ The Azure portal provides index size and vector index size. You can check these
123157

124158
Azure AI Search supports document-level operations so that you can look up, update, and delete a specific document in isolation. The following example shows how to delete a document.
125159

126-
Recall that deleted documents don't immediately free up space in the index. Every few minutes, a background process performs the physical deletion. Whether you use the portal or an API to return index statistics, you can expect a small delay before the deletion is reflected in the portal and through APIs.
160+
Deleting a document doesn't immediately free up space in the index. Every few minutes, a background process performs the physical deletion. Whether you use the portal or an API to return index statistics, you can expect a small delay before the deletion is reflected in the portal and API metrics.
127161

128162
1. Identify which field is the document key. In the portal, you can view the fields of each index. Document keys are string fields and are denoted with a key icon to make them easier to spot.
129163

articles/search/search-security-enable-roles.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ Roles for service administration (control plane) are built in and can't be enabl
2525
2626
## Prerequisites
2727

28-
+ Owner, User Access Administrator, or a custom role with [Microsoft.Authorization/roleAssignments/write](/azure/templates/microsoft.authorization/roleassignments) permissions.
29-
3028
+ A search service in any region, on any tier, including free.
3129

30+
+ Owner, User Access Administrator, or a custom role with [Microsoft.Authorization/roleAssignments/write](/azure/templates/microsoft.authorization/roleassignments) permissions.
31+
3232
## Enable role-based access for data plane operations
3333

3434
Configure your search service to recognize an **authorization** header on data requests that provide an OAuth2 access token.

articles/search/search-security-rbac.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ Role-based access is optional, but recommended. The alternative is [key-based au
3030

3131
## Prerequisites
3232

33-
+ **Owner**, **User Access Administrator**, or a custom role with [Microsoft.Authorization/roleAssignments/write](/azure/templates/microsoft.authorization/roleassignments) permissions.
34-
3533
+ A search service in any region, on any tier, [enabled for role-based access](search-security-enable-roles.md).
3634

35+
+ Owner, User Access Administrator, or a custom role with [Microsoft.Authorization/roleAssignments/write](/azure/templates/microsoft.authorization/roleassignments) permissions.
36+
3737
<a name = "built-in-roles-used-in-search"></a>
3838

3939
## Built-in roles used in Azure AI Search
@@ -51,7 +51,6 @@ The following roles are built in. If these roles are insufficient, [create a cus
5151

5252
Combine these roles to get sufficient permissions for your use case.
5353

54-
5554
> [!NOTE]
5655
> If you disable Azure role-based access, built-in roles for the control plane (Owner, Contributor, Reader) continue to be available. Disabling role-based access removes just the data-related permissions associated with those roles. If data plane roles are disabled, Search Service Contributor is equivalent to control-plane Contributor.
5756
@@ -278,15 +277,15 @@ This approach assumes Visual Studio Code with a REST client extension.
278277
az account get-access-token --query accessToken --output tsv
279278
```
280279

281-
1. In a new text file in Visual Studio Code, paste in these variables:
280+
1. Paste these variables in a new text file in Visual Studio Code.
282281

283282
```http
284283
@baseUrl = PASTE-YOUR-SEARCH-SERVICE-URL-HERE
285284
@index-name = PASTE-YOUR-INDEX-NAME-HERE
286285
@token = PASTE-YOUR-TOKEN-HERE
287286
```
288287

289-
1. Paste in and then send a request that uses the variables you've specified. For the "Search Index Data Reader" role, you can send a query. You can use any [supported API version](/rest/api/searchservice/search-service-api-versions).
288+
1. Paste and then send a request that uses the variables you've specified. For the "Search Index Data Reader" role, you can send a query. You can use any [supported API version](/rest/api/searchservice/search-service-api-versions).
290289

291290
```http
292291
POST https://{{baseUrl}}/indexes/{{index-name}}/docs/search?api-version=2023-11-01 HTTP/1.1
@@ -381,7 +380,7 @@ If you're already a Contributor or Owner of your search service, you can present
381380
Get-AzAccessToken -ResourceUrl https://search.azure.com
382381
```
383382

384-
1. In a new text file in Visual Studio Code, paste in these variables:
383+
1. Paste these variables into a new text file in Visual Studio Code.
385384

386385
```http
387386
@baseUrl = PASTE-YOUR-SEARCH-SERVICE-URL-HERE
@@ -539,15 +538,15 @@ The PowerShell example shows the JSON syntax for creating a custom role that's a
539538

540539
1. See [Create or update Azure custom roles using the REST API](../role-based-access-control/custom-roles-rest.md) for steps.
541540

542-
1. Clone or create a role, or use JSON to specify the custom role (see the PowerShell tab for JSON syntax).
541+
1. Copy or create a role, or use JSON to specify the custom role (see the PowerShell tab for JSON syntax).
543542

544543
### [**Azure CLI**](#tab/custom-role-cli)
545544

546545
1. Review the [list of atomic permissions](../role-based-access-control/resource-provider-operations.md#microsoftsearch) to determine which ones you need.
547546

548547
1. See [Create or update Azure custom roles using Azure CLI](../role-based-access-control/custom-roles-cli.md) for steps.
549548

550-
1. Clone or create a role, or use JSON to specify the custom role (see the PowerShell tab for JSON syntax).
549+
1. See the PowerShell tab for JSON syntax.
551550

552551
---
553552

articles/search/service-configure-firewall.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ ms.date: 06/27/2024
1515

1616
# Configure network access and firewall rules for Azure AI Search
1717

18-
This article explains how to configure network access to a search service's public endpoint. To block *all* data plane access to the public endpoint, use [private endpoints](service-create-private-endpoint.md) and an Azure virtual network.
18+
This article explains how to restrict network access to a search service's public endpoint. To block *all* data plane access to the public endpoint, use [private endpoints](service-create-private-endpoint.md) and an Azure virtual network.
1919

20-
This article assumes the Azure portal to configure network access options. You can also use the [Management REST API](/rest/api/searchmanagement/), [Azure PowerShell](/powershell/module/az.search), or the [Azure CLI](/cli/azure/search).
20+
This article assumes the Azure portal for configuring network access options. You can also use the [Management REST API](/rest/api/searchmanagement/), [Azure PowerShell](/powershell/module/az.search), or the [Azure CLI](/cli/azure/search).
2121

2222
## Prerequisites
2323

@@ -29,7 +29,9 @@ This article assumes the Azure portal to configure network access options. You c
2929

3030
By default, Azure AI Search is configured to allow connections over a public endpoint. Access to a search service *through* the public endpoint is protected by authentication and authorization protocols, but the endpoint itself is open to the internet at the network layer for data plane requests.
3131

32-
If you aren't hosting a public web site, you might want to configure network access to automatically refuse requests unless they originate from an approved set of devices and cloud services. There are two mechanisms:
32+
If you aren't hosting a public web site, you might want to configure network access to automatically refuse requests unless they originate from an approved set of devices and cloud services.
33+
34+
There are two mechanisms for restricting access to the public endpoint:
3335

3436
+ Inbound rules listing the IP addresses, ranges, or subnets from which requests are admitted
3537
+ Exceptions to network rules, where requests are admitted with no checks, as long as the request originates from a [trusted service](#grant-access-to-trusted-azure-services)
@@ -44,7 +46,7 @@ There are a few drawbacks to locking down the public endpoint.
4446

4547
+ It takes time to fully identify IP ranges and set up firewalls, and if you're in early stages of proof-of-concept testing and investigation and using sample data, you might want to defer network access controls until you actually need them.
4648

47-
+ Some workflows require access to a public endpoint. Specifically, the import wizards in the Azure portal, such as the [Import data wizard](search-get-started-portal.md) and [Import and vectorize data wizard](search-get-started-portal-import-vectors.md), connect to built-in (hosted) sample data and embedding models over the public endpoint. You can switch to code or script to complete the same tasks with firewall rules in place, but if you want to run the wizards, the public endpoint must be available. For more information, see [Secure connections in the import wizards](search-import-data-portal.md#secure-connections).
49+
+ Some workflows require access to a public endpoint. Specifically, the [**import wizards**](search-import-data-portal.md) in the Azure portal connect to built-in (hosted) sample data and embedding models over the public endpoint. You can switch to code or script to complete the same tasks when firewall rules in place, but if you want to run the wizards, the public endpoint must be available. For more information, see [Secure connections in the import wizards](search-import-data-portal.md#secure-connections).
4850

4951
<a id="configure-ip-policy"></a>
5052

@@ -62,7 +64,7 @@ There are a few drawbacks to locking down the public endpoint.
6264

6365
:::image type="content" source="media/service-configure-firewall/azure-portal-firewall-all.png" alt-text="Screenshot showing how to configure the IP firewall in the Azure portal.":::
6466

65-
1. Under **IP Firewall**, select **Add your client IP address** to create an inbound rule for the public IP address of your system. See [Allow access from the Azure portal IP address](#allow-access-from-the-azure-portal-ip-address) for details.
67+
1. Under **IP Firewall**, select **Add your client IP address** to create an inbound rule for the public IP address of your personal device. See [Allow access from the Azure portal IP address](#allow-access-from-the-azure-portal-ip-address) for details.
6668

6769
1. Add other client IP addresses for other devices and services that send requests to a search service.
6870

0 commit comments

Comments
 (0)