-
Notifications
You must be signed in to change notification settings - Fork 259
Expand file tree
/
Copy pathazure.search.documents.SearchClient.yml
More file actions
889 lines (772 loc) · 34.1 KB
/
azure.search.documents.SearchClient.yml
File metadata and controls
889 lines (772 loc) · 34.1 KB
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
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
### YamlMime:PythonClass
uid: azure.search.documents.SearchClient
name: SearchClient
fullName: azure.search.documents.SearchClient
module: azure.search.documents
summary: A client to interact with an existing Azure search index.
constructor:
syntax: 'SearchClient(endpoint: str, index_name: str, credential: AzureKeyCredential
| TokenCredential, **kwargs: Any)'
parameters:
- name: endpoint
description: The URL endpoint of an Azure search service
isRequired: true
types:
- <xref:str>
- name: index_name
description: The name of the index to connect to
isRequired: true
types:
- <xref:str>
- name: credential
description: A credential to authorize search client requests
isRequired: true
types:
- <xref:azure.core.credentials.AzureKeyCredential>
- <xref:azure.core.credentials.TokenCredential>
keywordOnlyParameters:
- name: api_version
description: The Search API version to use for requests.
types:
- <xref:str>
- name: audience
description: 'sets the Audience to use for authentication with Azure Active Directory
(AAD). The
audience is not considered when using a shared key. If audience is not provided,
the public cloud audience
will be assumed.'
types:
- <xref:str>
examples:
- "Creating the SearchClient with an API key.<!--[!code-python[Main](les\\sample_authentication.py\
\ )]-->\n\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"dupnames\"\
: [], \"backrefs\": [], \"source\": \"C:\\\\ToolCache\\\\Python\\\\3.11.9\\\\x64\\\
\\Lib\\\\site-packages\\\\py2docfx\\\\dist_temp\\\\259\\\\azure_search_documents-11.6.0\\\
\\samples\\\\sample_authentication.py\", \"xml:space\": \"preserve\", \"force\"\
: false, \"language\": \"python\", \"highlight_args\": {\"linenostart\": 1}, \"\
linenos\": false} -->\n\n````python\n\n from azure.core.credentials import AzureKeyCredential\n\
\ from azure.search.documents import SearchClient\n\n service_endpoint = os.environ[\"\
AZURE_SEARCH_SERVICE_ENDPOINT\"]\n index_name = os.environ[\"AZURE_SEARCH_INDEX_NAME\"\
]\n key = os.environ[\"AZURE_SEARCH_API_KEY\"]\n\n search_client = SearchClient(service_endpoint,\
\ index_name, AzureKeyCredential(key))\n\n ````\n"
methods:
- uid: azure.search.documents.SearchClient.autocomplete
name: autocomplete
summary: Get search auto-completion results from the Azure search index.
signature: 'autocomplete(search_text: str, suggester_name: str, *, mode: str | AutocompleteMode
| None = None, filter: str | None = None, use_fuzzy_matching: bool | None = None,
highlight_post_tag: str | None = None, highlight_pre_tag: str | None = None, minimum_coverage:
float | None = None, search_fields: List[str] | None = None, top: int | None =
None, **kwargs) -> List[Dict]'
parameters:
- name: search_text
description: The search text on which to base autocomplete results.
isRequired: true
types:
- <xref:str>
- name: suggester_name
description: 'The name of the suggester as specified in the suggesters
collection that''s part of the index definition.'
isRequired: true
types:
- <xref:str>
keywordOnlyParameters:
- name: mode
description: 'Specifies the mode for Autocomplete. The default is ''oneTerm''.
Use
''twoTerms'' to get shingles and ''oneTermWithContext'' to use the current context
while producing
auto-completed terms. Possible values include: ''oneTerm'', ''twoTerms'', ''oneTermWithContext''.'
defaultValue: None
types:
- <xref:str>
- <xref:azure.search.documents.models.AutocompleteMode>
- name: filter
description: 'An OData expression that filters the documents used to produce completed
terms
for the Autocomplete result.'
defaultValue: None
types:
- <xref:str>
- name: use_fuzzy_matching
description: 'A value indicating whether to use fuzzy matching for the
autocomplete query. Default is false. When set to true, the query will find
terms even if
there''s a substituted or missing character in the search text. While this provides
a better
experience in some scenarios, it comes at a performance cost as fuzzy autocomplete
queries are
slower and consume more resources.'
defaultValue: None
types:
- <xref:bool>
- name: highlight_post_tag
description: 'A string tag that is appended to hit highlights. Must be set with
highlightPreTag. If omitted, hit highlighting is disabled.'
defaultValue: None
types:
- <xref:str>
- name: highlight_pre_tag
description: 'A string tag that is prepended to hit highlights. Must be set with
highlightPostTag. If omitted, hit highlighting is disabled.'
defaultValue: None
types:
- <xref:str>
- name: minimum_coverage
description: 'A number between 0 and 100 indicating the percentage of the index
that
must be covered by an autocomplete query in order for the query to be reported
as a success.
This parameter can be useful for ensuring search availability even for services
with only one
replica. The default is 80.'
defaultValue: None
types:
- <xref:float>
- name: search_fields
description: 'The list of field names to consider when querying for auto-completed
terms. Target fields must be included in the specified suggester.'
defaultValue: None
types:
- <xref:list>[<xref:str>]
- name: top
description: 'The number of auto-completed terms to retrieve. This must be a value
between 1 and
100. The default is 5.'
defaultValue: None
types:
- <xref:int>
return:
description: List of auto-completion results.
types:
- <xref:list>[<xref:dict>]
examples:
- "Get a auto-completions.<!--[!code-python[Main](les\\sample_autocomplete.py )]-->\n\
\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"dupnames\"\
: [], \"backrefs\": [], \"source\": \"C:\\\\ToolCache\\\\Python\\\\3.11.9\\\\\
x64\\\\Lib\\\\site-packages\\\\py2docfx\\\\dist_temp\\\\259\\\\azure_search_documents-11.6.0\\\
\\samples\\\\sample_autocomplete.py\", \"xml:space\": \"preserve\", \"force\"\
: false, \"language\": \"python\", \"highlight_args\": {\"linenostart\": 1}, \"\
linenos\": false} -->\n\n````python\n\n from azure.core.credentials import AzureKeyCredential\n\
\ from azure.search.documents import SearchClient\n\n search_client = SearchClient(service_endpoint,\
\ index_name, AzureKeyCredential(key))\n\n results = search_client.autocomplete(search_text=\"\
bo\", suggester_name=\"sg\")\n\n print(\"Autocomplete suggestions for 'bo'\"\
)\n for result in results:\n print(\" Completion: {}\".format(result[\"\
text\"]))\n\n ````\n"
- uid: azure.search.documents.SearchClient.close
name: close
summary: 'Close the session.
:return: None
:rtype: None'
signature: close() -> None
- uid: azure.search.documents.SearchClient.delete_documents
name: delete_documents
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.'
signature: 'delete_documents(documents: List[Dict], **kwargs: Any) -> List[IndexingResult]'
parameters:
- name: documents
description: A list of documents to delete.
isRequired: true
types:
- <xref:list>[<xref:dict>]
return:
description: List of IndexingResult
types:
- <xref:list>[<xref:azure.search.documents.models.IndexingResult>]
examples:
- "Delete existing documents to an index<!--[!code-python[Main](les\\sample_crud_operations.py\
\ )]-->\n\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"\
dupnames\": [], \"backrefs\": [], \"source\": \"C:\\\\ToolCache\\\\Python\\\\\
3.11.9\\\\x64\\\\Lib\\\\site-packages\\\\py2docfx\\\\dist_temp\\\\259\\\\azure_search_documents-11.6.0\\\
\\samples\\\\sample_crud_operations.py\", \"xml:space\": \"preserve\", \"force\"\
: false, \"language\": \"python\", \"highlight_args\": {\"linenostart\": 1}, \"\
linenos\": false} -->\n\n````python\n\n result = search_client.delete_documents(documents=[{\"\
hotelId\": \"1000\"}])\n\n print(\"Delete new document succeeded: {}\".format(result[0].succeeded))\n\
\n ````\n"
- uid: azure.search.documents.SearchClient.get_document
name: get_document
summary: Retrieve a document from the Azure search index by its key.
signature: 'get_document(key: str, selected_fields: List[str] | None = None, **kwargs:
Any) -> Dict'
parameters:
- name: key
description: The primary key value for the document to retrieve
isRequired: true
types:
- <xref:str>
- name: selected_fields
description: an allow-list of fields to include in the results
defaultValue: None
types:
- <xref:list>[<xref:str>]
return:
description: The document as stored in the Azure search index
types:
- <xref:dict>
examples:
- "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\": \"C:\\\\ToolCache\\\\Python\\\\\
3.11.9\\\\x64\\\\Lib\\\\site-packages\\\\py2docfx\\\\dist_temp\\\\259\\\\azure_search_documents-11.6.0\\\
\\samples\\\\sample_get_document.py\", \"xml:space\": \"preserve\", \"force\"\
: false, \"language\": \"python\", \"highlight_args\": {\"linenostart\": 1}, \"\
linenos\": false} -->\n\n````python\n\n from azure.core.credentials import AzureKeyCredential\n\
\ from azure.search.documents import SearchClient\n\n search_client = SearchClient(service_endpoint,\
\ index_name, AzureKeyCredential(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"
- uid: azure.search.documents.SearchClient.get_document_count
name: get_document_count
summary: Return the number of documents in the Azure search index.
signature: 'get_document_count(**kwargs: Any) -> int'
return:
description: The count of documents in the index
types:
- <xref:int>
- uid: azure.search.documents.SearchClient.index_documents
name: index_documents
summary: 'Specify a document operations to perform as a batch.
:raises ~azure.search.documents.RequestEntityTooLargeError'
signature: 'index_documents(batch: IndexDocumentsBatch, **kwargs: Any) -> List[IndexingResult]'
parameters:
- name: batch
description: A batch of document operations to perform.
isRequired: true
types:
- <xref:azure.search.documents.IndexDocumentsBatch>
return:
description: List of IndexingResult
types:
- <xref:list>[<xref:azure.search.documents.models.IndexingResult>]
- uid: azure.search.documents.SearchClient.merge_documents
name: merge_documents
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.'
signature: 'merge_documents(documents: List[Dict], **kwargs: Any) -> List[IndexingResult]'
parameters:
- name: documents
description: A list of documents to merge.
isRequired: true
types:
- <xref:list>[<xref:dict>]
return:
description: List of IndexingResult
types:
- <xref:list>[<xref:azure.search.documents.models.IndexingResult>]
examples:
- "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\": \"C:\\\\\
ToolCache\\\\Python\\\\3.11.9\\\\x64\\\\Lib\\\\site-packages\\\\py2docfx\\\\dist_temp\\\
\\259\\\\azure_search_documents-11.6.0\\\\samples\\\\sample_crud_operations.py\"\
, \"xml:space\": \"preserve\", \"force\": false, \"language\": \"python\", \"\
highlight_args\": {\"linenostart\": 1}, \"linenos\": false} -->\n\n````python\n\
\n result = search_client.merge_documents(\n documents=[{\"hotelId\":\
\ \"1000\", \"rating\": 4.5}]\n )\n\n print(\"Merge into new document succeeded:\
\ {}\".format(result[0].succeeded))\n\n ````\n"
- uid: azure.search.documents.SearchClient.merge_or_upload_documents
name: merge_or_upload_documents
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.'
signature: 'merge_or_upload_documents(documents: List[Dict], **kwargs: Any) -> List[IndexingResult]'
parameters:
- name: documents
description: A list of documents to merge or upload.
isRequired: true
types:
- <xref:list>[<xref:dict>]
return:
description: List of IndexingResult
types:
- <xref:list>[<xref:azure.search.documents.models.IndexingResult>]
- uid: azure.search.documents.SearchClient.search
name: search
summary: Search the Azure search index for documents.
signature: 'search(search_text: str | None = None, *, include_total_count: bool
| None = None, facets: List[str] | None = None, filter: str | None = None, highlight_fields:
str | None = None, highlight_post_tag: str | None = None, highlight_pre_tag: str
| None = None, minimum_coverage: float | None = None, order_by: List[str] | None
= None, query_type: str | QueryType | None = None, scoring_parameters: List[str]
| None = None, scoring_profile: str | None = None, semantic_query: str | None
= None, search_fields: List[str] | None = None, search_mode: str | SearchMode
| None = None, query_answer: str | QueryAnswerType | None = None, query_answer_count:
int | None = None, query_answer_threshold: float | None = None, query_caption:
str | QueryCaptionType | None = None, query_caption_highlight_enabled: bool |
None = None, semantic_configuration_name: str | None = None, select: List[str]
| None = None, skip: int | None = None, top: int | None = None, scoring_statistics:
str | ScoringStatistics | None = None, session_id: str | None = None, vector_queries:
List[VectorQuery] | None = None, vector_filter_mode: str | VectorFilterMode |
None = None, semantic_error_mode: str | SemanticErrorMode | None = None, semantic_max_wait_in_milliseconds:
int | None = None, debug: str | QueryDebugMode | None = None, **kwargs: Any) ->
SearchItemPaged[Dict]'
parameters:
- name: search_text
description: 'A full-text search query expression; Use "*" or omit this parameter
to
match all documents.'
defaultValue: None
types:
- <xref:str>
keywordOnlyParameters:
- name: include_total_count
description: 'A value that specifies whether to fetch the total count of
results. Default is false. Setting this value to true may have a performance
impact. Note that
the count returned is an approximation.'
defaultValue: None
types:
- <xref:bool>
- name: facets
description: 'The list of facet expressions to apply to the search query. Each
facet
expression contains a field name, optionally followed by a comma-separated list
of name:value
pairs.'
defaultValue: None
types:
- <xref:list>[<xref:str>]
- name: filter
description: The OData $filter expression to apply to the search query.
defaultValue: None
types:
- <xref:str>
- name: highlight_fields
description: 'The comma-separated list of field names to use for hit highlights.
Only searchable fields can be used for hit highlighting.'
defaultValue: None
types:
- <xref:str>
- name: highlight_post_tag
description: 'A string tag that is appended to hit highlights. Must be set with
highlightPreTag. Default is </em>.'
defaultValue: None
types:
- <xref:str>
- name: highlight_pre_tag
description: 'A string tag that is prepended to hit highlights. Must be set with
highlightPostTag. Default is <em>.'
defaultValue: None
types:
- <xref:str>
- name: minimum_coverage
description: 'A number between 0 and 100 indicating the percentage of the index
that
must be covered by a search query in order for the query to be reported as a
success. This
parameter can be useful for ensuring search availability even for services with
only one
replica. The default is 100.'
defaultValue: None
types:
- <xref:float>
- name: order_by
description: 'The list of OData $orderby expressions by which to sort the results.
Each
expression can be either a field name or a call to either the geo.distance()
or the
search.score() functions. Each expression can be followed by asc to indicate
ascending, and
desc to indicate descending. The default is ascending order. Ties will be broken
by the match
scores of documents. If no OrderBy is specified, the default sort order is descending
by
document match score. There can be at most 32 $orderby clauses.'
defaultValue: None
types:
- <xref:list>[<xref:str>]
- name: query_type
description: 'A value that specifies the syntax of the search query. The default
is
''simple''. Use ''full'' if your query uses the Lucene query syntax. Possible
values include:
''simple'', ''full'', "semantic".'
defaultValue: None
types:
- <xref:str>
- <xref:azure.search.documents.models.QueryType>
- name: scoring_parameters
description: "The list of parameter values to be used in scoring functions (for\n\
example, referencePointParameter) using the format name-values. For example,\
\ if the scoring\nprofile defines a function with a parameter called 'mylocation'\
\ the parameter string would be\n\"mylocation\u2013122.2,44.8\" (without the\
\ quotes)."
defaultValue: None
types:
- <xref:list>[<xref:str>]
- name: scoring_profile
description: 'The name of a scoring profile to evaluate match scores for matching
documents in order to sort the results.'
defaultValue: None
types:
- <xref:str>
- name: semantic_query
description: 'Allows setting a separate search query that will be solely used
for
semantic reranking, semantic captions and semantic answers. Is useful for scenarios
where there
is a need to use different queries between the base retrieval and ranking phase,
and the L2
semantic phase.'
defaultValue: None
types:
- <xref:str>
- name: search_fields
description: 'The list of field names to which to scope the full-text search.
When
using fielded search (fieldName:searchExpression) in a full Lucene query, the
field names of
each fielded search expression take precedence over any field names listed in
this parameter.'
defaultValue: None
types:
- <xref:list>[<xref:str>]
- name: search_mode
description: 'A value that specifies whether any or all of the search terms must
be
matched in order to count the document as a match. Possible values include:
''any'', ''all''.'
defaultValue: None
types:
- <xref:str>
- <xref:azure.search.documents.models.SearchMode>
- name: query_answer
description: 'This parameter is only valid if the query type is ''semantic''.
If set,
the query returns answers extracted from key passages in the highest ranked
documents.
Possible values include: "none", "extractive".'
defaultValue: None
types:
- <xref:str>
- <xref:azure.search.documents.models.QueryAnswerType>
- name: query_answer_count
description: 'This parameter is only valid if the query type is ''semantic'' and
query answer is ''extractive''. Configures the number of answers returned. Default
count is 1.'
defaultValue: None
types:
- <xref:int>
- name: query_answer_threshold
description: 'This parameter is only valid if the query type is ''semantic'' and
query answer is ''extractive''. Configures the number of confidence threshold.
Default count is 0.7.'
defaultValue: None
types:
- <xref:float>
- name: query_caption
description: 'This parameter is only valid if the query type is ''semantic''.
If set, the
query returns captions extracted from key passages in the highest ranked documents.
Defaults to ''None''. Possible values include: "none", "extractive".'
defaultValue: None
types:
- <xref:str>
- <xref:azure.search.documents.models.QueryCaptionType>
- name: query_caption_highlight_enabled
description: 'This parameter is only valid if the query type is ''semantic'' when
query caption is set to ''extractive''. Determines whether highlighting is enabled.
Defaults to ''true''.'
defaultValue: None
types:
- <xref:bool>
- name: semantic_configuration_name
description: 'The name of the semantic configuration that will be used when
processing documents for queries of type semantic.'
defaultValue: None
types:
- <xref:str>
- name: select
description: 'The list of fields to retrieve. If unspecified, all fields marked
as retrievable
in the schema are included.'
defaultValue: None
types:
- <xref:list>[<xref:str>]
- name: skip
description: 'The number of search results to skip. This value cannot be greater
than 100,000.
If you need to scan documents in sequence, but cannot use $skip due to this
limitation,
consider using $orderby on a totally-ordered key and $filter with a range query
instead.'
defaultValue: None
types:
- <xref:int>
- name: top
description: 'The number of search results to retrieve. This can be used in conjunction
with
$skip to implement client-side paging of search results. If results are truncated
due to
server-side paging, the response will include a continuation token that can
be used to issue
another Search request for the next page of results.'
defaultValue: None
types:
- <xref:int>
- name: scoring_statistics
description: 'A value that specifies whether we want to calculate scoring
statistics (such as document frequency) globally for more consistent scoring,
or locally, for
lower latency. The default is ''local''. Use ''global'' to aggregate scoring
statistics globally
before scoring. Using global scoring statistics can increase latency of search
queries.
Possible values include: "local", "global".'
defaultValue: None
types:
- <xref:str>
- <xref:azure.search.documents.models.ScoringStatistics>
- name: session_id
description: 'A value to be used to create a sticky session, which can help getting
more
consistent results. As long as the same sessionId is used, a best-effort attempt
will be made
to target the same replica set. Be wary that reusing the same sessionID values
repeatedly can
interfere with the load balancing of the requests across replicas and adversely
affect the
performance of the search service. The value used as sessionId cannot start
with a ''_''
character.'
defaultValue: None
types:
- <xref:str>
- name: semantic_error_mode
description: 'Allows the user to choose whether a semantic call should fail
completely (default / current behavior), or to return partial results. Known
values are:
"partial" and "fail".'
defaultValue: None
types:
- <xref:str>
- <xref:azure.search.documents.models.SemanticErrorMode>
- name: semantic_max_wait_in_milliseconds
description: 'Allows the user to set an upper bound on the amount of
time it takes for semantic enrichment to finish processing before the request
fails.'
defaultValue: None
types:
- <xref:int>
- name: vector_queries
description: The query parameters for vector and hybrid search queries.
defaultValue: None
types:
- <xref:list>[<xref:azure.search.documents.models.VectorQuery>]
- name: vector_filter_mode
description: 'Determines whether or not filters are applied before or after the
vector search is performed. Known values are: "postFilter"
and "preFilter".'
defaultValue: None
types:
- <xref:str>
- <xref:azure.search.documents.models.VectorFilterMode>
- name: debug
description: 'Enables a debugging tool that can be used to further explore your
reranked
results. Known values are: "disabled" and "vector".'
defaultValue: None
types:
- <xref:str>
- <xref:azure.search.documents.models.QueryDebugMode>
return:
description: List of search results.
types:
- <xref:azure.search.documents.SearchItemPaged>[<xref:dict>]
examples:
- "Get search result facets.<!--[!code-python[Main](les\\sample_facet_query.py )]-->\n\
\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"dupnames\"\
: [], \"backrefs\": [], \"source\": \"C:\\\\ToolCache\\\\Python\\\\3.11.9\\\\\
x64\\\\Lib\\\\site-packages\\\\py2docfx\\\\dist_temp\\\\259\\\\azure_search_documents-11.6.0\\\
\\samples\\\\sample_facet_query.py\", \"xml:space\": \"preserve\", \"force\":\
\ false, \"language\": \"python\", \"highlight_args\": {\"linenostart\": 1}, \"\
linenos\": false} -->\n\n````python\n\n from azure.core.credentials import AzureKeyCredential\n\
\ from azure.search.documents import SearchClient\n\n search_client = SearchClient(service_endpoint,\
\ index_name, AzureKeyCredential(key))\n\n results = search_client.search(\n\
\ search_text=\"WiFi\", facets=[\"category,count:3\", \"parkingIncluded\"\
]\n )\n\n facets: Dict[str, List[str]] = cast(Dict[str, List[str]], results.get_facets())\n\
\n print(\"Catgory facet counts for hotels:\")\n for facet in facets[\"category\"\
]:\n print(\" {}\".format(facet))\n\n ````\n"
- uid: azure.search.documents.SearchClient.send_request
name: send_request
summary: Runs a network request using the client's existing pipeline.
signature: 'send_request(request: HttpRequest, *, stream: bool = False, **kwargs)
-> HttpResponse'
parameters:
- name: request
description: The network request you want to make.
isRequired: true
types:
- <xref:azure.core.rest.HttpRequest>
keywordOnlyParameters:
- name: stream
description: Whether the response payload will be streamed. Defaults to False.
defaultValue: 'False'
types:
- <xref:bool>
return:
description: The response of your network call. Does not do error handling on
your response.
types:
- <xref:azure.core.rest.HttpResponse>
- uid: azure.search.documents.SearchClient.suggest
name: suggest
summary: Get search suggestion results from the Azure search index.
signature: 'suggest(search_text: str, suggester_name: str, *, filter: str | None
= None, use_fuzzy_matching: bool | None = None, highlight_post_tag: str | None
= None, highlight_pre_tag: str | None = None, minimum_coverage: float | None =
None, order_by: List[str] | None = None, search_fields: List[str] | None = None,
select: List[str] | None = None, top: int | None = None, **kwargs) -> List[Dict]'
parameters:
- name: search_text
description: 'Required. The search text to use to suggest documents. Must be at
least 1
character, and no more than 100 characters.'
isRequired: true
types:
- <xref:str>
- name: suggester_name
description: 'Required. The name of the suggester as specified in the suggesters
collection that''s part of the index definition.'
isRequired: true
types:
- <xref:str>
keywordOnlyParameters:
- name: filter
description: An OData expression that filters the documents considered for suggestions.
defaultValue: None
types:
- <xref:str>
- name: use_fuzzy_matching
description: 'A value indicating whether to use fuzzy matching for the suggestions
query. Default is false. When set to true, the query will find terms even if
there''s a
substituted or missing character in the search text. While this provides a better
experience in
some scenarios, it comes at a performance cost as fuzzy suggestions queries
are slower and
consume more resources.'
defaultValue: None
types:
- <xref:bool>
- name: highlight_post_tag
description: 'A string tag that is appended to hit highlights. Must be set with
highlightPreTag. If omitted, hit highlighting of suggestions is disabled.'
defaultValue: None
types:
- <xref:str>
- name: highlight_pre_tag
description: 'A string tag that is prepended to hit highlights. Must be set with
highlightPostTag. If omitted, hit highlighting of suggestions is disabled.'
defaultValue: None
types:
- <xref:str>
- name: minimum_coverage
description: 'A number between 0 and 100 indicating the percentage of the index
that
must be covered by a suggestions query in order for the query to be reported
as a success. This
parameter can be useful for ensuring search availability even for services with
only one
replica. The default is 80.'
defaultValue: None
types:
- <xref:float>
- name: order_by
description: 'The list of OData $orderby expressions by which to sort the results.
Each
expression can be either a field name or a call to either the geo.distance()
or the
search.score() functions. Each expression can be followed by asc to indicate
ascending, or desc
to indicate descending. The default is ascending order. Ties will be broken
by the match scores
of documents. If no $orderby is specified, the default sort order is descending
by document
match score. There can be at most 32 $orderby clauses.'
defaultValue: None
types:
- <xref:list>[<xref:str>]
- name: search_fields
description: 'The list of field names to search for the specified search text.
Target
fields must be included in the specified suggester.'
defaultValue: None
types:
- <xref:list>[<xref:str>]
- name: select
description: 'The list of fields to retrieve. If unspecified, only the key field
will be
included in the results.'
defaultValue: None
types:
- <xref:list>[<xref:str>]
- name: top
description: 'The number of suggestions to retrieve. The value must be a number
between 1 and
100. The default is 5.'
defaultValue: None
types:
- <xref:int>
return:
description: List of suggestion results.
types:
- <xref:list>[<xref:dict>]
examples:
- "Get search suggestions.<!--[!code-python[Main](les\\sample_suggestions.py )]-->\n\
\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"dupnames\"\
: [], \"backrefs\": [], \"source\": \"C:\\\\ToolCache\\\\Python\\\\3.11.9\\\\\
x64\\\\Lib\\\\site-packages\\\\py2docfx\\\\dist_temp\\\\259\\\\azure_search_documents-11.6.0\\\
\\samples\\\\sample_suggestions.py\", \"xml:space\": \"preserve\", \"force\":\
\ false, \"language\": \"python\", \"highlight_args\": {\"linenostart\": 1}, \"\
linenos\": false} -->\n\n````python\n\n from azure.core.credentials import AzureKeyCredential\n\
\ from azure.search.documents import SearchClient\n\n search_client = SearchClient(service_endpoint,\
\ index_name, AzureKeyCredential(key))\n\n results = search_client.suggest(search_text=\"\
coffee\", suggester_name=\"sg\")\n\n print(\"Search suggestions for 'coffee'\"\
)\n for result in results:\n hotel = search_client.get_document(key=result[\"\
hotelId\"])\n print(\n \" Text: {} for Hotel: {}\".format(\n\
\ repr(result[\"text\"]), hotel[\"hotelName\"]\n )\n \
\ )\n\n ````\n"
- uid: azure.search.documents.SearchClient.upload_documents
name: upload_documents
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.'
signature: 'upload_documents(documents: List[Dict], **kwargs: Any) -> List[IndexingResult]'
parameters:
- name: documents
description: A list of documents to upload.
isRequired: true
types:
- <xref:list>[<xref:dict>]
return:
description: List of IndexingResult
types:
- <xref:list>[<xref:azure.search.documents.models.IndexingResult>]
examples:
- "Upload new documents to an index<!--[!code-python[Main](les\\sample_crud_operations.py\
\ )]-->\n\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"\
dupnames\": [], \"backrefs\": [], \"source\": \"C:\\\\ToolCache\\\\Python\\\\\
3.11.9\\\\x64\\\\Lib\\\\site-packages\\\\py2docfx\\\\dist_temp\\\\259\\\\azure_search_documents-11.6.0\\\
\\samples\\\\sample_crud_operations.py\", \"xml:space\": \"preserve\", \"force\"\
: false, \"language\": \"python\", \"highlight_args\": {\"linenostart\": 1}, \"\
linenos\": false} -->\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"