forked from MicrosoftDocs/azure-docs-sdk-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure.search.SearchIndexClient.yml
481 lines (458 loc) · 18.5 KB
/
azure.search.SearchIndexClient.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
### YamlMime:UniversalReference
api_name: []
items:
- children:
- azure.search.SearchIndexClient.autocomplete
- azure.search.SearchIndexClient.close
- azure.search.SearchIndexClient.delete_documents
- azure.search.SearchIndexClient.get_document
- azure.search.SearchIndexClient.get_document_count
- azure.search.SearchIndexClient.index_documents
- azure.search.SearchIndexClient.merge_documents
- azure.search.SearchIndexClient.merge_or_upload_documents
- azure.search.SearchIndexClient.search
- azure.search.SearchIndexClient.suggest
- azure.search.SearchIndexClient.upload_documents
class: azure.search.SearchIndexClient
example:
- "Creating the SearchIndexClient with an API key.<!--[!code-python[Main](les\\\
sample_authentication.py )]-->\n\n<!-- literal_block {\"ids\": [], \"classes\"\
: [], \"names\": [], \"dupnames\": [], \"backrefs\": [], \"source\": \"D:\\\\\
a\\\\1\\\\s\\\\source_code\\\\5\\\\azure-search-1.0.0b1\\\\samples\\\\sample_authentication.py\"\
, \"xml:space\": \"preserve\", \"language\": \"python\", \"linenos\": false, \"\
highlight_args\": {\"linenostart\": 1}} -->\n\n````python\n\n from azure.search\
\ import SearchApiKeyCredential, SearchIndexClient\n service_endpoint = os.getenv(\"\
AZURE_SEARCH_SERVICE_ENDPOINT\")\n index_name = os.getenv(\"AZURE_SEARCH_INDEX_NAME\"\
)\n key = os.getenv(\"AZURE_SEARCH_API_KEY\")\n\n search_client = SearchIndexClient(service_endpoint,\
\ index_name, SearchApiKeyCredential(key))\n\n ````\n"
fullName: azure.search.SearchIndexClient
inheritance:
- type: builtins.object
langs:
- python
module: azure.search
name: SearchIndexClient
summary: A client to interact with an existing Azure search index.
syntax:
content: SearchIndexClient(endpoint, index_name, credential, **kwargs)
parameters:
- description: The URL endpoint of an Azure search service
id: endpoint
type:
- str
- description: The name of the index to connect to
id: index_name
type:
- str
- description: A credential to authorize search client requests
id: credential
type:
- SearchApiKeyCredential
type: class
uid: azure.search.SearchIndexClient
- class: azure.search.SearchIndexClient
example:
- "Get a auto-completions.<!--[!code-python[Main](les\\sample_autocomplete.py )]-->\n\
\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"dupnames\"\
: [], \"backrefs\": [], \"source\": \"D:\\\\a\\\\1\\\\s\\\\source_code\\\\5\\\\\
azure-search-1.0.0b1\\\\samples\\\\sample_autocomplete.py\", \"xml:space\": \"\
preserve\", \"language\": \"python\", \"linenos\": false, \"highlight_args\":\
\ {\"linenostart\": 1}} -->\n\n````python\n\n from azure.search import AutocompleteQuery,\
\ SearchApiKeyCredential, SearchIndexClient\n\n search_client = SearchIndexClient(service_endpoint,\
\ index_name, SearchApiKeyCredential(key))\n\n query = AutocompleteQuery(search_text=\"\
bo\", suggester_name=\"sg\")\n\n results = search_client.autocomplete(query=query)\n\
\n print(\"Autocomplete suggestions for 'bo'\")\n for result in results:\n\
\ print(\" Completion: {}\".format(result[\"text\"]))\n\n ````\n"
fullName: azure.search.SearchIndexClient.autocomplete
langs:
- python
module: azure.search
name: autocomplete(query, **kwargs)
summary: Get search auto-completion results from the Azure search index.
syntax:
content: autocomplete(query, **kwargs)
parameters:
- description: An query for auto-completions
id: query
return:
type:
- List[dict]
type: method
uid: azure.search.SearchIndexClient.autocomplete
- class: azure.search.SearchIndexClient
fullName: azure.search.SearchIndexClient.close
langs:
- python
module: azure.search
name: close()
summary: Close the <xref:azure.search.SearchIndexClient> session.
syntax:
content: close()
parameters: []
type: method
uid: azure.search.SearchIndexClient.close
- class: azure.search.SearchIndexClient
example:
- "Delete existing documents to an index<!--[!code-python[Main](les\\sample_crud_operations.py\
\ )]-->\n\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"\
dupnames\": [], \"backrefs\": [], \"source\": \"D:\\\\a\\\\1\\\\s\\\\source_code\\\
\\5\\\\azure-search-1.0.0b1\\\\samples\\\\sample_crud_operations.py\", \"xml:space\"\
: \"preserve\", \"language\": \"python\", \"linenos\": false, \"highlight_args\"\
: {\"linenostart\": 1}} -->\n\n````python\n\n result = search_client.upload_documents(documents=[{\"\
HotelId\": \"1000\"}])\n\n print(\"Delete new document succeeded: {}\".format(result[0].succeeded))\n\
\n ````\n"
fullName: azure.search.SearchIndexClient.delete_documents
langs:
- python
module: azure.search
name: delete_documents(documents, **kwargs)
summary: 'Delete documents from the Azure search index
Delete removes the specified document from the index. Any field you
specify in a delete operation, other than the key field, will be
ignored. If you want to remove an individual field from a document, use
*merge_documents* instead and set the field explicitly to None.
Delete operations are idempotent. That is, even if a document key does
not exist in the index, attempting a delete operation with that key will
result in a 200 status code.'
syntax:
content: delete_documents(documents, **kwargs)
parameters:
- description: A list of documents to delete.
id: documents
type:
- List[dict]
return:
type:
- List[IndexingResult]
type: method
uid: azure.search.SearchIndexClient.delete_documents
- class: azure.search.SearchIndexClient
example:
- "Get a specific document from the search index.<!--[!code-python[Main](les\\sample_get_document.py\
\ )]-->\n\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"\
dupnames\": [], \"backrefs\": [], \"source\": \"D:\\\\a\\\\1\\\\s\\\\source_code\\\
\\5\\\\azure-search-1.0.0b1\\\\samples\\\\sample_get_document.py\", \"xml:space\"\
: \"preserve\", \"language\": \"python\", \"linenos\": false, \"highlight_args\"\
: {\"linenostart\": 1}} -->\n\n````python\n\n from azure.search import SearchApiKeyCredential,\
\ SearchIndexClient\n\n search_client = SearchIndexClient(service_endpoint,\
\ index_name, SearchApiKeyCredential(key))\n\n result = search_client.get_document(key=\"\
23\")\n\n print(\"Details for hotel '23' are:\")\n print(\" Name: {}\"\
.format(result[\"HotelName\"]))\n print(\" Rating: {}\".format(result[\"\
Rating\"]))\n print(\" Category: {}\".format(result[\"Category\"]))\n\n \
\ ````\n"
fullName: azure.search.SearchIndexClient.get_document
langs:
- python
module: azure.search
name: get_document(key, selected_fields=None, **kwargs)
summary: Retrieve a document from the Azure search index by its key.
syntax:
content: get_document(key, selected_fields=None, **kwargs)
parameters:
- description: The primary key value for the document to retrieve
id: key
type:
- str
- description: a whitelist of fields to include in the results
id: selected_fields
type:
- List[str]
return:
type:
- dict
type: method
uid: azure.search.SearchIndexClient.get_document
- class: azure.search.SearchIndexClient
fullName: azure.search.SearchIndexClient.get_document_count
langs:
- python
module: azure.search
name: get_document_count(**kwargs)
summary: Return the number of documents in the Azure search index.
syntax:
content: get_document_count(**kwargs)
return:
type:
- int
type: method
uid: azure.search.SearchIndexClient.get_document_count
- class: azure.search.SearchIndexClient
fullName: azure.search.SearchIndexClient.index_documents
langs:
- python
module: azure.search
name: index_documents(batch, **kwargs)
summary: Specify a document operations to perform as a batch.
syntax:
content: index_documents(batch, **kwargs)
parameters:
- description: A batch of document operations to perform.
id: batch
type:
- IndexDocumentsBatch
return:
type:
- List[IndexingResult]
type: method
uid: azure.search.SearchIndexClient.index_documents
- class: azure.search.SearchIndexClient
example:
- "Merge fields into existing documents to an index<!--[!code-python[Main](les\\\
sample_crud_operations.py )]-->\n\n<!-- literal_block {\"ids\": [], \"classes\"\
: [], \"names\": [], \"dupnames\": [], \"backrefs\": [], \"source\": \"D:\\\\\
a\\\\1\\\\s\\\\source_code\\\\5\\\\azure-search-1.0.0b1\\\\samples\\\\sample_crud_operations.py\"\
, \"xml:space\": \"preserve\", \"language\": \"python\", \"linenos\": false, \"\
highlight_args\": {\"linenostart\": 1}} -->\n\n````python\n\n result = search_client.upload_documents(documents=[{\"\
HotelId\": \"1000\", \"Rating\": 4.5}])\n\n print(\"Merge into new document\
\ succeeded: {}\".format(result[0].succeeded))\n\n ````\n"
fullName: azure.search.SearchIndexClient.merge_documents
langs:
- python
module: azure.search
name: merge_documents(documents, **kwargs)
summary: 'Merge documents in to existing documents in the Azure search index.
Merge updates an existing document with the specified fields. If the
document doesn''t exist, the merge will fail. Any field you specify in a
merge will replace the existing field in the document. This also applies
to collections of primitive and complex types.'
syntax:
content: merge_documents(documents, **kwargs)
parameters:
- description: A list of documents to merge.
id: documents
type:
- List[dict]
return:
type:
- List[IndexingResult]
type: method
uid: azure.search.SearchIndexClient.merge_documents
- class: azure.search.SearchIndexClient
fullName: azure.search.SearchIndexClient.merge_or_upload_documents
langs:
- python
module: azure.search
name: merge_or_upload_documents(documents, **kwargs)
summary: 'Merge documents in to existing documents in the Azure search index,
or upload them if they do not yet exist.
This action behaves like *merge_documents* if a document with the given
key already exists in the index. If the document does not exist, it
behaves like *upload_documents* with a new document.'
syntax:
content: merge_or_upload_documents(documents, **kwargs)
parameters:
- description: A list of documents to merge or upload.
id: documents
type:
- List[dict]
return:
type:
- List[IndexingResult]
type: method
uid: azure.search.SearchIndexClient.merge_or_upload_documents
- class: azure.search.SearchIndexClient
example:
- "Get search result facets.<!--[!code-python[Main](les\\sample_facet_query.py )]-->\n\
\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"dupnames\"\
: [], \"backrefs\": [], \"source\": \"D:\\\\a\\\\1\\\\s\\\\source_code\\\\5\\\\\
azure-search-1.0.0b1\\\\samples\\\\sample_facet_query.py\", \"xml:space\": \"\
preserve\", \"language\": \"python\", \"linenos\": false, \"highlight_args\":\
\ {\"linenostart\": 1}} -->\n\n````python\n\n from azure.search import SearchApiKeyCredential,\
\ SearchIndexClient, SearchQuery\n\n search_client = SearchIndexClient(service_endpoint,\
\ index_name, SearchApiKeyCredential(key))\n\n query = SearchQuery(search_text=\"\
WiFi\", facets=[\"Category\"], top=0)\n\n results = search_client.search(query=query)\n\
\n facets = results.get_facets()\n\n print(\"Catgory facet counts for hotels:\"\
)\n for facet in facets[\"Category\"]:\n print(\" {}\".format(facet))\n\
\ # [END filter_query]\n\n _name__ == '__main__':\n filter_query()\n ````\n"
fullName: azure.search.SearchIndexClient.search
langs:
- python
module: azure.search
name: search(query, **kwargs)
summary: Search the Azure search index for documents.
syntax:
content: search(query, **kwargs)
parameters:
- description: An query for searching the index
id: query
return:
type:
- SearchItemPaged[dict]
type: method
uid: azure.search.SearchIndexClient.search
- class: azure.search.SearchIndexClient
example:
- "Get search suggestions.<!--[!code-python[Main](les\\sample_suggestions.py )]-->\n\
\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"dupnames\"\
: [], \"backrefs\": [], \"source\": \"D:\\\\a\\\\1\\\\s\\\\source_code\\\\5\\\\\
azure-search-1.0.0b1\\\\samples\\\\sample_suggestions.py\", \"xml:space\": \"\
preserve\", \"language\": \"python\", \"linenos\": false, \"highlight_args\":\
\ {\"linenostart\": 1}} -->\n\n````python\n\n from azure.search import SearchApiKeyCredential,\
\ SearchIndexClient, SuggestQuery\n\n search_client = SearchIndexClient(service_endpoint,\
\ index_name, SearchApiKeyCredential(key))\n\n query = SuggestQuery(search_text=\"\
coffee\", suggester_name=\"sg\")\n\n results = search_client.suggest(query=query)\n\
\n print(\"Search suggestions for 'coffee'\")\n for result in results:\n \
\ hotel = search_client.get_document(key=result[\"HotelId\"])\n print(\"\
\ Text: {} for Hotel: {}\".format(repr(result[\"text\"]), hotel[\"HotelName\"\
]))\n\n ````\n"
fullName: azure.search.SearchIndexClient.suggest
langs:
- python
module: azure.search
name: suggest(query, **kwargs)
summary: Get search suggestion results from the Azure search index.
syntax:
content: suggest(query, **kwargs)
parameters:
- description: An query for search suggestions
id: query
return:
type:
- List[dict]
type: method
uid: azure.search.SearchIndexClient.suggest
- class: azure.search.SearchIndexClient
example:
- "Upload new documents to an index<!--[!code-python[Main](les\\sample_crud_operations.py\
\ )]-->\n\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"\
dupnames\": [], \"backrefs\": [], \"source\": \"D:\\\\a\\\\1\\\\s\\\\source_code\\\
\\5\\\\azure-search-1.0.0b1\\\\samples\\\\sample_crud_operations.py\", \"xml:space\"\
: \"preserve\", \"language\": \"python\", \"linenos\": false, \"highlight_args\"\
: {\"linenostart\": 1}} -->\n\n````python\n\n DOCUMENT = {\n 'Category':\
\ 'Hotel',\n 'HotelId': '1000',\n 'Rating': 4.0,\n 'Rooms':\
\ [],\n 'HotelName': 'Azure Inn',\n }\n\n result = search_client.upload_documents(documents=[DOCUMENT])\n\
\n print(\"Upload of new document succeeded: {}\".format(result[0].succeeded))\n\
\n ````\n"
fullName: azure.search.SearchIndexClient.upload_documents
langs:
- python
module: azure.search
name: upload_documents(documents, **kwargs)
summary: 'Upload documents to the Azure search index.
An upload action is similar to an "upsert" where the document will be
inserted if it is new and updated/replaced if it exists. All fields are
replaced in the update case.'
syntax:
content: upload_documents(documents, **kwargs)
parameters:
- description: A list of documents to upload.
id: documents
type:
- List[dict]
return:
type:
- List[IndexingResult]
type: method
uid: azure.search.SearchIndexClient.upload_documents
references:
- fullName: azure.search.SearchIndexClient.autocomplete
isExternal: false
name: autocomplete(query, **kwargs)
parent: azure.search.SearchIndexClient
uid: azure.search.SearchIndexClient.autocomplete
- fullName: azure.search.SearchIndexClient.close
isExternal: false
name: close()
parent: azure.search.SearchIndexClient
uid: azure.search.SearchIndexClient.close
- fullName: azure.search.SearchIndexClient.delete_documents
isExternal: false
name: delete_documents(documents, **kwargs)
parent: azure.search.SearchIndexClient
uid: azure.search.SearchIndexClient.delete_documents
- fullName: azure.search.SearchIndexClient.get_document
isExternal: false
name: get_document(key, selected_fields=None, **kwargs)
parent: azure.search.SearchIndexClient
uid: azure.search.SearchIndexClient.get_document
- fullName: azure.search.SearchIndexClient.get_document_count
isExternal: false
name: get_document_count(**kwargs)
parent: azure.search.SearchIndexClient
uid: azure.search.SearchIndexClient.get_document_count
- fullName: azure.search.SearchIndexClient.index_documents
isExternal: false
name: index_documents(batch, **kwargs)
parent: azure.search.SearchIndexClient
uid: azure.search.SearchIndexClient.index_documents
- fullName: azure.search.SearchIndexClient.merge_documents
isExternal: false
name: merge_documents(documents, **kwargs)
parent: azure.search.SearchIndexClient
uid: azure.search.SearchIndexClient.merge_documents
- fullName: azure.search.SearchIndexClient.merge_or_upload_documents
isExternal: false
name: merge_or_upload_documents(documents, **kwargs)
parent: azure.search.SearchIndexClient
uid: azure.search.SearchIndexClient.merge_or_upload_documents
- fullName: azure.search.SearchIndexClient.search
isExternal: false
name: search(query, **kwargs)
parent: azure.search.SearchIndexClient
uid: azure.search.SearchIndexClient.search
- fullName: azure.search.SearchIndexClient.suggest
isExternal: false
name: suggest(query, **kwargs)
parent: azure.search.SearchIndexClient
uid: azure.search.SearchIndexClient.suggest
- fullName: azure.search.SearchIndexClient.upload_documents
isExternal: false
name: upload_documents(documents, **kwargs)
parent: azure.search.SearchIndexClient
uid: azure.search.SearchIndexClient.upload_documents
- fullName: List[dict]
name: List[dict]
spec.python:
- fullName: List
name: List
uid: List
- fullName: '['
name: '['
- fullName: dict
name: dict
uid: dict
- fullName: ']'
name: ']'
uid: List[dict]
- fullName: List[IndexingResult]
name: List[IndexingResult]
spec.python:
- fullName: List
name: List
uid: List
- fullName: '['
name: '['
- fullName: IndexingResult
name: IndexingResult
uid: IndexingResult
- fullName: ']'
name: ']'
uid: List[IndexingResult]
- fullName: List[str]
name: List[str]
spec.python:
- fullName: List
name: List
uid: List
- fullName: '['
name: '['
- fullName: str
name: str
uid: str
- fullName: ']'
name: ']'
uid: List[str]
- fullName: SearchItemPaged[dict]
name: SearchItemPaged[dict]
spec.python:
- fullName: SearchItemPaged
name: SearchItemPaged
uid: SearchItemPaged
- fullName: '['
name: '['
- fullName: dict
name: dict
uid: dict
- fullName: ']'
name: ']'
uid: SearchItemPaged[dict]