Skip to content

azure-search-documents Readme and Samples Issues #12072

@v-xuto

Description

@v-xuto

Section link:
image
Question 1:
Reason:
Cannot import name 'CorsOptions' from 'azure.search.documents.indexes'

Suggestion:

from azure.search.documents.indexes import SearchIndexClient 
from azure.search.documents.indexes.models import ( 
    ComplexField, 
    CorsOptions, 
    SearchIndex, 
    ScoringProfile, 
    SearchFieldDataType, 
    SimpleField, 
    SearchableField 
) 

Question 2:
Reason:
azure.core.exceptions.HttpResponseError: () The request is invalid. Details: definition : The complex field 'address' cannot have the retrievable property set. Instead, set the retrievable property on sub-fields of the complex type.

Suggestion:
Update the code here as follows:

retrievable=None if search_field.hidden is None else not search_field.hidden 

Script link:
image
Question 1:
Reason:
Name 'Index' is not defined.

Suggestion:
Update Index to SearchIndex.

Question 2:
The same problem exists in the script: sample_index_crud_operations_async.py
Reason:
create_or_update() got multiple values for keyword argument 'index_name' .

Suggestion:

result = client.create_or_update_index(index=index) 

Script sample_synonym_map_operations.py and sample_synonym_map_operations_async.py
image
Reason:
'SynonymMap' object is not subscriptable.

Suggestion:
Update x['name'] to x.name .
Update result['synonyms'] to result.synonyms .
4.
Script sample_indexers_operations.py
image
Question 1:
This same problem exists in the following script: sample_indexers_operations_async.py ,
sample_indexer_datasource_skillset.py
Reason:
'SearchIndexerClient' object has no attribute 'create_datasource' .

Suggestion:

container = SearchIndexerDataContainer(name='searchcontainer') 
data_source_connection = SearchIndexerDataSourceConnection( 
    name="indexer-datasource", 
    type="azureblob", 
    connection_string=connection_string, 
    container=container 
) 
result = indexers_client.create_data_source_connection(data_source_connection) 

Question 2:
Reason:
azure.core.exceptions.HttpResponseError: () This indexer refers to an index 'hotels' that doesn't exist.

Suggestion:
Update target_index_name="hotels" to target_index_name="indexer-hotels".
5.
Script sample_data_source_operations_async.py:
image
Reason:
'SearchIndexerClient' object has no attribute 'delete_datasource'.

Suggestion:
Update delete_datasource to delete_data_source_connection.

Metadata

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.DocsSearchbugThis issue requires a change to an existing behavior in the product in order to be resolved.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions