This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.33k
stars
1.97k
forks
source link
FIrst snippet for index creation does not work #42161
However, when creating the index using the snippet, I got the following exception
Status code 400, "{"error":{"code":"OperationNotAllowed","message":"The request is invalid. Details: index : Found 0 key fields in index 'hotels'. Each index must have exactly one key field.","details":[{"code":"MissingKeyField","message":"Found 0 key fields in index 'hotels'. Each index must have exactly one key field. Parameters: index"}]}}"
Indeed, the 'id' field, although if annotated properly, was not enabled as key field.
In addition, the 'static' qualifier should be removed from the Hotel class definition
Java version: 1.8
Azure Search SDK version: 11.6.0
OS: Windows
Type of issue
Code doesn't work
Description
I copied both the Hotel java model
and the snippet for index creation
However, when creating the index using the snippet, I got the following exception
Indeed, the 'id' field, although if annotated properly, was not enabled as key field. In addition, the 'static' qualifier should be removed from the Hotel class definition
Java version: 1.8 Azure Search SDK version: 11.6.0 OS: Windows
Page URL
https://learn.microsoft.com/en-us/java/api/overview/azure/search-documents-readme?view=azure-java-stable
Content source URL
https://github.com/Azure/azure-docs-sdk-java/blob/master/docs-ref-services/latest/search-documents-readme.md
Document Version Independent Id
91939d9d-2088-c3a5-dcdf-79d89da3a927
Article author
@azure-sdk
Metadata