Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SearchIndexClient.GetIndexNames throws #15590

Closed
bleroy opened this issue Sep 30, 2020 · 1 comment · Fixed by #15950
Closed

SearchIndexClient.GetIndexNames throws #15590

bleroy opened this issue Sep 30, 2020 · 1 comment · Fixed by #15950
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. Search

Comments

@bleroy
Copy link
Contributor

bleroy commented Sep 30, 2020

Describe the bug
Calling SearchIndexClient.GetIndexNames throws an ArgumentNullException with the message "Fields cannot be null. To clear values, call Clear. (Parameter 'value')".

Expected behavior
The method should return the list of index names.

Actual behavior (include Exception or Stack Trace)
Calling SearchIndexClient.GetIndexNames throws an ArgumentNullException with the message "Fields cannot be null. To clear values, call Clear. (Parameter 'value')".

The reason this is happening is that GetIndexNames calls IndexesClient.List with Constants.NameKey, which results in a JSON document missing all properties except for the name of the index. Attempting to deserialize this then fails because fields are required, and are missing (despite definitely existing on the actual indexes) in the JSON getting passed in.

The implementation of GetIndexNames and GetIndexNamesAsync should either use a different new method on the IndexerRestClient that doesn't attempt to deserialize indexes but just extracts the name that are needed, or should Constants.All before it does the deserialization like GetIndexes does.

Workaround
Use SearchIndexClient.GetIndexes(serviceName, credentials).Select(idx => idx.Name) instead.

To Reproduce
Call SearchIndexClient.GetIndexNames.

Environment:

  • Name and version of the Library package used: Azure.Search.Documents 11.1.1
  • Hosting platform or OS and .NET runtime version (dotnet --info output for .NET Core projects): .NET Core 3.1
  • IDE and version : Visual Studio 16.8.0 Preview 3.2
@ghost ghost added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Sep 30, 2020
@bleroy bleroy added the Search label Sep 30, 2020
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Sep 30, 2020
@heaths heaths added the Client This issue points to a problem in the data-plane of the library. label Oct 1, 2020
@heaths heaths added this to the [2020] November milestone Oct 1, 2020
@heaths
Copy link
Member

heaths commented Oct 1, 2020

Since we're close to code complete and I have another issue I'm working on, I'm moving this to November. If we need this for October 6th, please let me know ASAP.

heaths added a commit to heaths/azure-sdk-for-net that referenced this issue Oct 14, 2020
annelo-msft pushed a commit to annelo-msft/azure-sdk-for-net that referenced this issue Feb 17, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. Search
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants