-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
All,
I have added one addional field in the index.But while creating index I am getting following error. Can you please help me what went wrong here?
azure.core.exceptions.HttpResponseError: () The request is invalid. Details: The property 'skey' does not exist on type 'search.documentFields' or is not present in the API version '2025-08-01-preview
Please find below modified code
async with self.search_info.create_search_client() as search_client:
for batch_index, batch in enumerate(section_batches):
documents = []
for section_index, section in enumerate(batch):
image_fields = {}
if self.search_images:
image_fields = {
"images": [
{
"url": image.url,
"description": image.description,
"boundingbox": image.bbox,
"embedding": image.embedding,
}
for image in section.chunk.images
]
}
document = {
# "id": f"{section.content.filename_to_id()}-page-{section_index + batch_index * MAX_BATCH_SIZE}",
"id": f"{fileKey}-p{section_index + batch_index * MAX_BATCH_SIZE}",
"skey": f"{fileKey}",
"content": section.chunk.text,
"category": section.category,
"sourcepage": BlobManager.sourcepage_from_file_page(
filename=section.content.filename(), page=section.chunk.page_num
),
"sourcefile": section.content.filename(),
**image_fields,
**section.content.acls,
}
documents.append(document)
if url:
for document in documents:
document["storageUrl"] = url
if self.embeddings:
if self.field_name_embedding is None:
raise ValueError("Embedding field name must be set")
embeddings = await self.embeddings.create_embeddings(
texts=[section.chunk.text for section in batch]
)
for i, document in enumerate(documents):
document[self.field_name_embedding] = embeddings[i]
logger.info(
"Uploading batch %d with %d sections to search index '%s'",
batch_index + 1,
len(documents),
self.search_info.index_name,
)