Skip to content

Cannot create index due to missing key #48216

Open
@alhell

Description

@alhell

Library name and version

Azure.Search.Service 10.1.0

Describe the bug

Cannot create index.

public class DocumentIndex
{
    [SimpleField(IsKey = true)]
    public string metadata_storage_path { get; set; }

.
.
.
.
.
}

Error
Microsoft.Rest.Azure.CloudException: 'The request is invalid. Details: index : Found 0 key fields in index 'index'. Each index must have exactly one key field.'

Expected behavior

Index Created

Actual behavior

Error
Microsoft.Rest.Azure.CloudException: 'The request is invalid. Details: index : Found 0 key fields in index 'index'. Each index must have exactly one key field.'

Reproduction Steps

foreach (var index in Indexes.IndexList)
{

  var definition = new Index()
  {
      Name = index,
      Fields = FieldBuilder.BuildForType<DocumentIndex>()
  };
  await client.Indexes.CreateAsync(definition);

}

Environment

No response

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