0
# Search Service Management
1
2
Core operations for creating, updating, deleting, and configuring Azure Search services. These operations enable complete lifecycle management of search services including provisioning, scaling, status monitoring, and service configuration.
3
4
## Capabilities
5
6
### Service Creation and Updates
7
8
Create new search services or update existing ones with comprehensive configuration options including SKU, capacity, networking, security, and feature settings.
9
10
```python { .api }
11
def create_or_update(
12
resource_group_name: str,
13
search_service_name: str,
14
service: SearchService,
15
*,
16
client_request_id: Optional[str] = None,
17
**kwargs
18
) -> LROPoller[SearchService]:
19
"""
20
Create or update a search service.
21
22
Parameters:
23
resource_group_name (str): Resource group name
24
search_service_name (str): Search service name (2-60 chars, alphanumeric and hyphens)
25
service (SearchService): Service configuration
26
client_request_id (str, optional): Client-generated request ID for tracking
27
28
Returns:
29
LROPoller[SearchService]: Long-running operation for service creation/update
30
31
Raises:
32
ResourceExistsError: Service already exists (for create operations)
33
HttpResponseError: Invalid configuration or quota exceeded
34
"""
35
36
def update(
37
resource_group_name: str,
38
search_service_name: str,
39
service: SearchServiceUpdate,
40
*,
41
client_request_id: Optional[str] = None,
42
**kwargs
43
) -> SearchService:
44
"""
45
Update an existing search service with partial configuration changes.
46
47
Parameters:
48
resource_group_name (str): Resource group name
49
search_service_name (str): Search service name
50
service (SearchServiceUpdate): Partial service updates
51
client_request_id (str, optional): Client-generated request ID
52
53
Returns:
54
SearchService: Updated service configuration
55
"""
56
```
57
58
**Usage Example:**
59
60
```python
61
from azure.mgmt.search.models import (
62
SearchService, SearchServiceUpdate, Sku, SkuName,
63
PublicNetworkAccess, NetworkRuleSet, IpRule, SearchBypass
64
)
65
66
# Create a new search service
67
search_service = SearchService(
68
location="East US",
69
sku=Sku(name=SkuName.STANDARD),
70
replica_count=2,
71
partition_count=1,
72
public_network_access=PublicNetworkAccess.ENABLED,
73
network_rule_set=NetworkRuleSet(
74
ip_rules=[IpRule(value="203.0.113.0/24")],
75
bypass=SearchBypass.AZURE_PORTAL
76
),
77
tags={"environment": "production", "team": "search"}
78
)
79
80
# Start the creation operation
81
create_operation = client.services.begin_create_or_update(
82
resource_group_name="my-resource-group",
83
search_service_name="my-search-service",
84
service=search_service
85
)
86
87
# Wait for completion (can take 15+ minutes)
88
service = create_operation.result()
89
print(f"Service created: {service.name}, Status: {service.status}")
90
91
# Update service to add more replicas
92
service_update = SearchServiceUpdate(
93
replica_count=3,
94
tags={"environment": "production", "team": "search", "scaled": "true"}
95
)
96
97
updated_service = client.services.update(
98
resource_group_name="my-resource-group",
99
search_service_name="my-search-service",
100
service=service_update
101
)
102
```
103
104
### Service Retrieval
105
106
Get detailed information about existing search services including configuration, status, and metadata.
107
108
```python { .api }
109
def get(
110
resource_group_name: str,
111
search_service_name: str,
112
*,
113
client_request_id: Optional[str] = None,
114
**kwargs
115
) -> SearchService:
116
"""
117
Get a search service by name.
118
119
Parameters:
120
resource_group_name (str): Resource group name
121
search_service_name (str): Search service name
122
client_request_id (str, optional): Client-generated request ID
123
124
Returns:
125
SearchService: Complete service configuration and status
126
127
Raises:
128
ResourceNotFoundError: Service does not exist
129
"""
130
```
131
132
### Service Listing
133
134
List search services by resource group or subscription for inventory and management operations.
135
136
```python { .api }
137
def list_by_resource_group(
138
resource_group_name: str,
139
*,
140
client_request_id: Optional[str] = None,
141
**kwargs
142
) -> ItemPaged[SearchService]:
143
"""
144
List all search services in a resource group.
145
146
Parameters:
147
resource_group_name (str): Resource group name
148
client_request_id (str, optional): Client-generated request ID
149
150
Returns:
151
ItemPaged[SearchService]: Paginated list of search services
152
"""
153
154
def list_by_subscription(
155
*,
156
client_request_id: Optional[str] = None,
157
**kwargs
158
) -> ItemPaged[SearchService]:
159
"""
160
List all search services in the subscription.
161
162
Parameters:
163
client_request_id (str, optional): Client-generated request ID
164
165
Returns:
166
ItemPaged[SearchService]: Paginated list of search services across all resource groups
167
"""
168
```
169
170
**Usage Example:**
171
172
```python
173
# Get specific service details
174
service = client.services.get("my-resource-group", "my-search-service")
175
print(f"Service: {service.name}")
176
print(f"Status: {service.status}")
177
print(f"SKU: {service.sku.name}")
178
print(f"Replicas: {service.replica_count}")
179
print(f"Partitions: {service.partition_count}")
180
181
# List all services in resource group
182
rg_services = client.services.list_by_resource_group("my-resource-group")
183
for service in rg_services:
184
print(f"RG Service: {service.name} - {service.status}")
185
186
# List all services in subscription
187
all_services = client.services.list_by_subscription()
188
for service in all_services:
189
print(f"Subscription Service: {service.name} in {service.location}")
190
```
191
192
### Service Deletion
193
194
Delete search services and clean up associated resources.
195
196
```python { .api }
197
def delete(
198
resource_group_name: str,
199
search_service_name: str,
200
*,
201
client_request_id: Optional[str] = None,
202
**kwargs
203
) -> None:
204
"""
205
Delete a search service and all its data.
206
207
Parameters:
208
resource_group_name (str): Resource group name
209
search_service_name (str): Search service name to delete
210
client_request_id (str, optional): Client-generated request ID
211
212
Raises:
213
ResourceNotFoundError: Service does not exist
214
"""
215
```
216
217
### Name Availability Check
218
219
Check if a search service name is available before attempting to create the service.
220
221
```python { .api }
222
def check_name_availability(
223
name: str,
224
*,
225
client_request_id: Optional[str] = None,
226
**kwargs
227
) -> CheckNameAvailabilityOutput:
228
"""
229
Check if a search service name is available.
230
231
Parameters:
232
name (str): Service name to check (2-60 chars, alphanumeric and hyphens)
233
client_request_id (str, optional): Client-generated request ID
234
235
Returns:
236
CheckNameAvailabilityOutput: Availability status and reason if unavailable
237
"""
238
```
239
240
**Usage Example:**
241
242
```python
243
from azure.mgmt.search.models import CheckNameAvailabilityInput
244
245
# Check name availability
246
availability = client.services.check_name_availability("my-unique-search-service")
247
if availability.is_name_available:
248
print("Name is available")
249
else:
250
print(f"Name unavailable: {availability.reason} - {availability.message}")
251
```
252
253
### Service Upgrade
254
255
Upgrade search services to the latest version for new features and improvements.
256
257
```python { .api }
258
def begin_upgrade(
259
resource_group_name: str,
260
search_service_name: str,
261
**kwargs
262
) -> LROPoller[SearchService]:
263
"""
264
Upgrade a search service to the latest version available.
265
266
Parameters:
267
resource_group_name (str): Resource group name
268
search_service_name (str): Search service name
269
270
Returns:
271
LROPoller[SearchService]: Long-running operation for service upgrade, returns updated service
272
273
Raises:
274
ResourceNotFoundError: Service does not exist
275
HttpResponseError: Upgrade not available or operation failed
276
"""
277
```
278
279
**Usage Example:**
280
281
```python
282
# Check if upgrade is available and upgrade the service
283
try:
284
# Start the upgrade operation
285
upgrade_operation = client.services.begin_upgrade(
286
resource_group_name="my-resource-group",
287
search_service_name="my-search-service"
288
)
289
290
print("Upgrade started. This may take several minutes...")
291
292
# Wait for the upgrade to complete
293
upgraded_service = upgrade_operation.result()
294
print(f"Upgrade completed successfully")
295
print(f"Service version updated: {upgraded_service.name}")
296
297
except HttpResponseError as e:
298
if e.status_code == 409:
299
print("Service is already at the latest version")
300
else:
301
print(f"Upgrade failed: {e.message}")
302
```
303
304
## Data Models
305
306
### SearchService
307
308
Complete search service configuration and status information.
309
310
```python { .api }
311
class SearchService:
312
"""
313
Azure Search service configuration and status.
314
315
Attributes:
316
id (str): Fully qualified resource ID
317
name (str): Service name
318
type (str): Resource type
319
location (str): Azure region
320
tags (Dict[str, str]): Resource tags
321
identity (Identity): Managed identity configuration
322
sku (Sku): Pricing tier and capacity
323
replica_count (int): Number of search replicas (1-12)
324
partition_count (int): Number of search partitions (1-12)
325
hosting_mode (HostingMode): Hosting mode configuration
326
public_network_access (PublicNetworkAccess): Public network access
327
status (SearchServiceStatus): Current service status
328
status_details (str): Additional status information
329
provisioning_state (ProvisioningState): Resource provisioning state
330
network_rule_set (NetworkRuleSet): Network access rules
331
encryption_with_cmk (EncryptionWithCmk): Customer-managed key encryption
332
disable_local_auth (bool): Local authentication disabled
333
auth_options (DataPlaneAuthOptions): Authentication options
334
data_exfiltration_protection (SearchDataExfiltrationProtection): Data protection
335
semantic_search (SearchSemanticSearch): Semantic search capability
336
private_endpoint_connections (List[PrivateEndpointConnection]): Private endpoints
337
shared_private_link_resources (List[SharedPrivateLinkResource]): Shared private links
338
"""
339
```
340
341
### SearchServiceUpdate
342
343
Partial update model for modifying existing services.
344
345
```python { .api }
346
class SearchServiceUpdate:
347
"""
348
Partial updates for existing search service.
349
350
Attributes:
351
tags (Dict[str, str]): Updated resource tags
352
sku (Sku): Updated pricing tier
353
replica_count (int): Updated replica count
354
partition_count (int): Updated partition count
355
hosting_mode (HostingMode): Updated hosting mode
356
public_network_access (PublicNetworkAccess): Updated network access
357
network_rule_set (NetworkRuleSet): Updated network rules
358
identity (Identity): Updated managed identity
359
encryption_with_cmk (EncryptionWithCmk): Updated encryption settings
360
disable_local_auth (bool): Updated local auth setting
361
auth_options (DataPlaneAuthOptions): Updated auth options
362
data_exfiltration_protection (SearchDataExfiltrationProtection): Updated protection
363
semantic_search (SearchSemanticSearch): Updated semantic search
364
"""
365
```
366
367
### CheckNameAvailabilityOutput
368
369
Result of name availability check.
370
371
```python { .api }
372
class CheckNameAvailabilityOutput:
373
"""
374
Name availability check result.
375
376
Attributes:
377
is_name_available (bool): Whether the name is available
378
reason (UnavailableNameReason): Reason if unavailable
379
message (str): Detailed message about availability
380
"""
381
382
class UnavailableNameReason(str, Enum):
383
"""Reasons why a name might be unavailable."""
384
INVALID = "invalid"
385
ALREADY_EXISTS = "already_exists"
386
```
387
388
### Service Status Enums
389
390
```python { .api }
391
class SearchServiceStatus(str, Enum):
392
"""Search service status values."""
393
RUNNING = "running"
394
PROVISIONING = "provisioning"
395
DELETING = "deleting"
396
DEGRADED = "degraded"
397
DISABLED = "disabled"
398
ERROR = "error"
399
400
class ProvisioningState(str, Enum):
401
"""Resource provisioning states."""
402
SUCCEEDED = "succeeded"
403
PROVISIONING = "provisioning"
404
FAILED = "failed"
405
406
class HostingMode(str, Enum):
407
"""Service hosting modes."""
408
DEFAULT = "default"
409
HIGH_DENSITY = "high_density"
410
```