TRying to create a search index with parameters
Created a skillset with azure search documents indexes models but setting the parameters for indexers facing an issue
HttpResponseError Traceback (most recent call last)
Cell In[172], line 29
13 indexer = SearchIndexer(
14 name=indexer_name,
15 description="Indexer to index documents and generate embeddings",
(...)
25 field_mappings=[FieldMapping(source_field_name="metadata_storage_name", target_field_name="title")]
26 )
28 indexer_client = SearchIndexerClient(endpoint, credential)
---> 29 indexer_result = indexer_client.create_or_update_indexer(indexer)
31 # Run the indexer
32 indexer_client.run_indexer(indexer_name)
File ~\AppData\Local\anaconda3\Lib\site-packages\azure\core\tracing\decorator.py:78, in distributed_trace.
File ~\AppData\Local\anaconda3\Lib\site-packages\azure\search\documents\indexes_search_indexer_client.py:134, in SearchIndexerClient.create_or_update_indexer(self, indexer, match_condition, **kwargs) 132 kwargs.update(access_condition) 133 name = indexer.name --> 134 result = self._client.indexers.create_or_update( 135 indexer_name=name, indexer=indexer, prefer="return=representation", error_map=error_map, **kwargs 136 ) 137 return result
File ~\AppData\Local\anaconda3\Lib\site-packages\azure\core\tracing\decorator.py:78, in distributed_trace.
File ~\AppData\Local\anaconda3\Lib\site-packages\azure\search\documents\indexes_generated\operations_indexers_operations.py:827, in IndexersOperations.create_or_update(self, indexer_name, prefer, indexer, if_match, if_none_match, skip_indexer_reset_requirement_for_cache, disable_cache_reprocessing_change_detection, request_options, **kwargs) 825 map_error(status_code=response.status_code, response=response, error_map=error_map) 826 error = self._deserialize.failsafe_deserialize(_models.SearchError, pipeline_response) --> 827 raise HttpResponseError(response=response, model=error) 829 if response.status_code == 200: 830 deserialized = self._deserialize("SearchIndexer", pipeline_response)
HttpResponseError: () The request is invalid. Details: The property 'parsingMode' does not exist on type 'Microsoft.Azure.Search.V2023_10_01_Preview.IndexingParameters'. Make sure to only use property names that are defined by the type. Code: Message: The request is invalid. Details: The property 'parsingMode' does not exist on type 'Microsoft.Azure.Search.V2023_10_01_Preview.IndexingParameters'. Make sure to only use property names that are defined by the type.
Thank you for the feedback @Nalin879 . We will investigate and get back to you asap.
Thanks for reaching out.
Could you help to provide the information:
the version of azure-search-documents and azure-core libraries.
The code snippet to repro the issue?
Thank you.
Hi @Nalin879. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.
code:
SearchIndexer,
FieldMapping,
IndexingParametersConfiguration,
BlobIndexerImageAction,
BlobIndexerDataToExtract,
BlobIndexerParsingMode
)
# Create an indexer
indexer_name = f"{index_name}-indexer"
indexer = SearchIndexer(
name=indexer_name,
description="Indexer to index documents and generate embeddings",
skillset_name=skillset_name,
target_index_name=index_name,
data_source_name=data_source.name,
parameters=IndexingParametersConfiguration(
image_action=BlobIndexerImageAction.GENERATE_NORMALIZED_IMAGES,
data_to_extract=BlobIndexerDataToExtract.CONTENT_AND_METADATA,
parsing_mode=BlobIndexerParsingMode.DEFAULT
),
# Map the metadata_storage_name field to the title field in the index to display the PDF title in the search results
field_mappings=[FieldMapping(source_field_name="metadata_storage_name", target_field_name="title")]
)
indexer_client = SearchIndexerClient(endpoint, credential)
indexer_result = indexer_client.create_or_update_indexer(indexer)
# Run the indexer
indexer_client.run_indexer(indexer_name)
print(f' {indexer_name} is created and running. If queries return no results, please wait a bit and try again.')
azure search documents VERSION = "11.6.0b1" # type: str azure core VERSION = "1.30.0"
Thanks for sharing your code.
I am afraid it is not the recommended way to create the indexer.
Could you follow the sample and try again?
https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_indexer_datasource_skillset.py#L119
Hi @Nalin879. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.
Hi @Nalin879, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!