Skip to content

Create SearchIndexer from JSON fails #44210

@thulard

Description

@thulard
  • Package Name: azure-search-documents
  • Package Version: 11.6.0
  • Operating System: Windows Server 2025
  • Python Version: 3.12.10

Describe the bug
SearchIndexer.from_dict() failed with error:

azure.core.exceptions.DeserializationError: Unable to deserialize {} into model <class 'azure.search.documents.indexes.models._models.SearchIndexer'>. SearchIndexer.__init__() missing 3 required keyword-only arguments: 'name', 'data_source_name', and 'target_index_name'

To Reproduce
Steps to reproduce the behavior:

  1. create a json definition of the indexer
  2. load the json
  3. call SearchIndexer.from_dict()
import json
from azure.search.documents.indexes.models import SearchIndexer

# Define path to index definition
indexer_json_path = "indexer.json"

# Load JSON definition
with open(indexer_json_path, "r", encoding="utf-8") as f:
    indexer_json = json.load(f)

# Convert JSON to SearchIndexer object
indexer = SearchIndexer.from_dict(indexer_json)

Expected behavior
The SearchIndexer object should be create without error.

Additional context
Workaround is to call the internal function as follow:

indexer = SearchIndexer._from_generated(_SearchIndexer.from_dict(indexer_json))

Metadata

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.Searchcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions