You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/search/includes/quickstarts/full-text-intro.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,9 @@ author: haileytap
4
4
ms.author: haileytapia
5
5
ms.service: azure-ai-search
6
6
ms.topic: include
7
-
ms.date: 06/23/2025
7
+
ms.date: 06/26/2025
8
8
---
9
9
10
10
In this quickstart, you use the Azure.Search.Documents client library to create, load, and query a search index with sample data for [full-text search](../../search-lucene-query-architecture.md). Full-text search uses Apache Lucene for indexing and queries and the BM25 ranking algorithm for scoring results.
11
11
12
-
This quickstart creates and queries a small index containing data about four fictional hotels.
12
+
This quickstart uses fictional hotel data from the [azure-search-sample-data](https://github.com/Azure-Samples/azure-search-sample-data/tree/main/hotels/hotel-json-documents) repo to populate the index.
Copy file name to clipboardExpand all lines: articles/search/includes/quickstarts/full-text-powershell.md
+63-44Lines changed: 63 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ ms.date: 06/26/2025
9
9
10
10
In this quickstart, you use PowerShell and the [Azure AI Search REST APIs](/rest/api/searchservice/) to create, load, and query a search index for [full-text search](../../search-lucene-query-architecture.md). Full-text search uses Apache Lucene for indexing and queries and the BM25 ranking algorithm for scoring results.
11
11
12
-
This quickstart creates and queries a small index containing data about four fictional hotels.
12
+
This quickstart uses fictional hotel data from the [azure-search-sample-data](https://github.com/Azure-Samples/azure-search-sample-data/tree/main/hotels/hotel-json-documents) repo to populate the index.
13
13
14
14
> [!TIP]
15
15
> You can download the [source code](https://github.com/Azure-Samples/azure-search-powershell-samples/tree/main/Quickstart) to start with a finished project or follow these steps to create your own.
@@ -22,7 +22,7 @@ This quickstart creates and queries a small index containing data about four fic
22
22
23
23
+ The [Azure CLI](/cli/azure/install-azure-cli) for keyless authentication with Microsoft Entra ID.
24
24
25
-
+[PowerShell 7.3](https://github.com/PowerShell/PowerShell) or later. This quickstart uses the [Invoke-RestMethod](/powershell/module/Microsoft.PowerShell.Utility/Invoke-RestMethod) cmdlet to make REST API calls.
25
+
+[PowerShell 7.3](https://github.com/PowerShell/PowerShell) or later. This quickstart uses [Invoke-RestMethod](/powershell/module/Microsoft.PowerShell.Utility/Invoke-RestMethod) to make REST API calls.
26
26
27
27
## Configure access
28
28
@@ -46,37 +46,35 @@ To configure the recommended role-based access:
46
46
47
47
For more information, see [Connect to Azure AI Search using roles](../../search-security-rbac.md).
48
48
49
-
## Get resource name
49
+
## Get endpoint
50
50
51
51
In the next section, you specify the following endpoint to establish a connection to your Azure AI Search service. These steps assume that you [configured role-based access](#configure-access).
52
52
53
-
To get your resource name:
53
+
To get your service endpoint:
54
54
55
55
1. Sign in to the [Azure portal](https://portal.azure.com/) and select your search service.
56
56
57
57
1. From the left pane, select **Overview**.
58
58
59
-
1.Take note of the name before `.search.windows.net` in the URL, such as `my-service` in`https://my-service.search.windows.net`.
59
+
1.Make a note of the URL, which should be similar to`https://my-service.search.windows.net`.
60
60
61
61
## Connect to Azure AI Search
62
62
63
-
Before you can make REST API calls to Azure AI Search, you must authenticate and connect to your search service.
64
-
65
-
You start by using the Azure CLI to sign in to Azure and obtain your Microsoft Entra token. You then configure the HTTP header and service URL used in subsequent requests. To maintain authentication throughout this quickstart, all of these commands are run in the same PowerShell session.
63
+
Before you can make REST API calls to your Azure AI Search service, you must authenticate and connect to the service. You perform the following steps in PowerShell, which supports the Azure CLI commands used in steps two and three.
66
64
67
65
To connect to your search service:
68
66
69
67
1. On your local system, open PowerShell.
70
68
71
69
1. Sign in to your Azure subscription. If you have multiple subscriptions, select the one that contains your search service.
72
70
73
-
```powershell
71
+
```azurecli
74
72
az login
75
73
```
76
74
77
75
1. Create a `$token` object to store your access token.
@@ -91,10 +89,10 @@ To connect to your search service:
91
89
92
90
You only need to set the header once per session, but you must add it to each request.
93
91
94
-
1. Create a `$url` object that targets the indexes collection on your search service. Replace `<YOUR-SEARCH-SERVICE>` with the value you obtained in [Get resource name](#get-resource-name).
92
+
1. Create a `$url` object that targets the indexes collection on your search service. Replace `<YOUR-SEARCH-SERVICE>` with the value you obtained in [Get endpoint](#get-endpoint).
1. Run `Invoke-RestMethod` to send a GET request to your search service and verify the connection. Include `ConvertTo-Json` to view responses from the service.
@@ -116,13 +114,13 @@ To connect to your search service:
116
114
117
115
## Create, load, and query a search index
118
116
119
-
In this section, you run PowerShell commands to create a search index, upload documents to the index, and query the indexed documents. Responses to the `Invoke-RestMethod` commands are displayed in the PowerShell console. For more information about each step, see [Explaining the code](#explaining-the-code).
117
+
In this section, you make REST API calls to create a search index, upload documents to the index, and query the indexed documents. Responses to `Invoke-RestMethod` are displayed in the PowerShell console. For more information about each step, see [Explaining the code](#explaining-the-code).
120
118
121
-
For each command that updates the `$url` object, replace `<YOUR-SEARCH-SERVICE>` with the value you obtained in [Get resource name](#get-resource-name).
119
+
Run the following commands in the same PowerShell session you started in the previous section. For each command that updates the `$url` object, replace `<YOUR-SEARCH-SERVICE>` with the value you obtained in [Get endpoint](#get-endpoint).
122
120
123
121
To create, load, and query an index:
124
122
125
-
1. Define the index schema in a `$body` object.
123
+
1. Create a `$body` object to define the index schema.
126
124
127
125
```powershell
128
126
$body = @"
@@ -154,18 +152,18 @@ To create, load, and query an index:
154
152
1. Update the `$url` object to target the new index.
The response should contain the JSON representation of the index schema.
167
165
168
-
1. Create a `$body` object that contains sample documents to upload to your index.
166
+
1. Create a `$body` object to store the JSON payload of four sample documents.
169
167
170
168
```powershell
171
169
$body = @"
@@ -195,7 +193,7 @@ To create, load, and query an index:
195
193
"HotelId": "2",
196
194
"HotelName": "Old Century Hotel",
197
195
"Description": "The hotel is situated in a nineteenth century plaza, which has been expanded and renovated to the highest architectural standards to create a modern, functional and first-class hotel in which art and unique historical elements coexist with the most modern comforts. The hotel also regularly hosts events like wine tastings, beer dinners, and live music.",
198
-
"Category": "Boutique",
196
+
"Category": "Boutique",
199
197
"Tags": [ "pool", "free wifi", "concierge" ],
200
198
"ParkingIncluded": false,
201
199
"LastRenovationDate": "2019-02-18T00:00:00Z",
@@ -233,6 +231,7 @@ To create, load, and query an index:
233
231
"HotelId": "4",
234
232
"HotelName": "Sublime Palace Hotel",
235
233
"Description": "Sublime Palace Hotel is located in the heart of the historic center of Sublime in an extremely vibrant and lively area within short walking distance to the sites and landmarks of the city and is surrounded by the extraordinary beauty of churches, buildings, shops and monuments. Sublime Cliff is part of a lovingly restored 19th century resort, updated for every modern convenience.",
Within our index schema, the `fields` collection defines the structure of hotel documents. Each field has a `name`, data `type`, and attributes that determine its behavior during indexing and queries. The `HotelId` field is marked as the key, which Azure AI Search requires to uniquely identify each document in an index.
@@ -336,9 +335,9 @@ Key points about the index schema:
336
335
337
336
Newly created indexes are empty. To populate an index and make it searchable, you must upload JSON documents that conform to the index schema.
338
337
339
-
In Azure AI Search, documents serve as both inputs for indexing and outputs for queries. For simplicity, this quickstart provides sample hotel documents as inline JSON. In production scenarios, however, content is typically pulled from connected data sources and transformed into JSON using [indexers](../../search-indexer-overview.md).
338
+
In Azure AI Search, documents serve as both inputs for indexing and outputs for queries. For simplicity, this quickstart provides sample hotel documents as inline JSON. In production scenarios, however, content is often pulled from connected data sources and transformed into JSON using [indexers](../../search-indexer-overview.md).
340
339
341
-
This quickstart calls [Documents - Index (REST API)](/rest/api/searchservice/documents/index) to add four sample hotel documents to your index.
340
+
This quickstart calls [Documents - Index (REST API)](/rest/api/searchservice/documents/) to add four sample hotel documents to your index.
Each document in the `value` array represents a hotel and contains fields that match the index schema. The `@search.action` parameter specifies the operation to perform for each document. Our example uses `upload`, which adds the document if it doesn't exist or updates the document if it does exist.
375
374
376
375
### Query the index
377
376
378
-
Now that documents are loaded into the index, you can issue full-text queries against them using PowerShell commands.
377
+
Now that documents are loaded into your index, you can issue full-text queries against them.
379
378
380
-
This quickstart calls [Documents - Search Post (REST API)](/rest/api/searchservice/documents/search-post) to find hotel documents in your index based on the search criteria.
379
+
This quickstart calls [Documents - Search Post (REST API)](/rest/api/searchservice/documents/search-post) to find hotel documents that match your search criteria.
Full-text search requests always include a `search` parameter that contains the query text. The query text can include one or more terms, phrases, or operators. You can also specify parameters to refine the search behavior and results.
385
+
Full-text search requests always include a `search` parameter that contains the query text. The query text can include one or more terms, phrases, or operators. In addition to `search`, you can specify other parameters to refine the search behavior and results.
386
+
387
+
Our query searches for the terms "attached restaurant" in the `Description` and `Tags` fields of each hotel document. The `$select` parameter limits the fields returned in the response to `HotelId`, `HotelName`, `Tags`, and `Description`. The `$count` parameter requests the total number of matching documents.
388
+
389
+
The response should be similar to the following example, which shows one matching hotel document, its relevance score, and its selected fields.
387
390
388
-
Our example performs an empty search (`search=*`) that returns all documents in the index. The `$count=true` parameter includes the total number of matching documents in the response.
"Description": "The Gastronomic Hotel stands out for its culinary excellence under the management of William Dough, who advises on and oversees all of the Hotel’s restaurant services.",
401
+
"Tags": "restaurant bar continental breakfast"
402
+
}
403
+
]
404
+
}
405
+
```
389
406
390
407
#### Other query examples
391
408
392
-
Try some other query examples to explore the syntax. You can perform string searches, use `$filter` expressions, limit result sets, select specific fields, and more.
409
+
Run the following commands to explore the query syntax. You can perform string searches, use `$filter` expressions, limit result sets, select specific fields, and more.
393
410
394
411
```powershell
395
412
# Query example 1
396
-
# Search the entire index for the terms 'restaurant' and 'wifi'
413
+
# Search the index for the terms 'restaurant' and 'wifi'
397
414
# Return only the HotelName, Description, and Tags fields
0 commit comments