exam questions

Exam AZ-203 All Questions

View all questions & answers for the AZ-203 exam

Exam AZ-203 topic 5 question 5 discussion

Actual exam question from Microsoft's AZ-203
Question #: 5
Topic #: 5
[All AZ-203 Questions]

You are developing a project management service by using ASP.NET. The service hosts conservations, files, to-do lists, and a calendar that users can interact with at any time.
The application uses Azure Search for allowing users to search for keywords in the project data.
You need to implement code that creates the object which is used to create indexes in the Azure Search service.
Which two objects should you use? Each correct answer presents part of the solution.
NOTE: Each correct selection is worth one point.

  • A. SearchCredentials
  • B. SearchIndexClient
  • C. SearchServiceClient
  • D. SearchService
Show Suggested Answer Hide Answer
Suggested Answer: BC 🗳️
The various client libraries define classes like Index, Field, and Document, as well as operations like Indexes.Create and Documents.Search on the
SearchServiceClient and SearchIndexClient classes.
Example:
The sample application we'll be exploring creates a new index named "hotels", populates it with a few documents, then executes some search queries. Here is the main program, showing the overall flow:
/ This sample shows how to delete, create, upload documents and query an index static void Main(string[] args)
{
IConfigurationBuilder builder = new ConfigurationBuilder().AddJsonFile("appsettings.json");
IConfigurationRoot configuration = builder.Build();
SearchServiceClient serviceClient = CreateSearchServiceClient(configuration);
Console.WriteLine("{0}", "Deleting index...\n");
DeleteHotelsIndexIfExists(serviceClient);
Console.WriteLine("{0}", "Creating index...\n");
CreateHotelsIndex(serviceClient);
ISearchIndexClient indexClient = serviceClient.Indexes.GetClient("hotels");
References:
https://docs.microsoft.com/en-us/azure/search/search-howto-dotnet-sdk

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
lywwind
Highly Voted 5 years, 4 months ago
Correct Answer: A C ? SearchServiceClient serviceClient = new SearchServiceClient(searchServiceName, new SearchCredentials(adminApiKey));
upvoted 36 times
Dumindu
5 years, 2 months ago
this is the correct answer
upvoted 4 times
Dumindu
5 years, 2 months ago
A and C
upvoted 4 times
...
courtguard
2 years, 1 month ago
SearchServiceClient(String, SearchCredentials) - Initializes a new instance of the SearchServiceClient class.
upvoted 1 times
...
...
[Removed]
5 years ago
I think the answer BC is correct. The SearchServiceClient has many other constructors apart from the one using SearchCredentials object. https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.search.searchserviceclient?view=azure-dotnet#constructors But we will always need a combination of SearchServiceClient and SearchIndexClient to index.
upvoted 3 times
lau13
4 years, 11 months ago
Not really, this is how to create index: serviceClient.Indexes.Create(__definition__); SearchIndexClient is needed only if you want to populate the index, but the question is asking "the object which is used to create indexes" so you don't need to populate. When you are creating index, you need the write access, you have to use SearchCredentials in the constructor in this scenario.
upvoted 4 times
...
...
...
PHARKGAOYOU
Highly Voted 4 years, 11 months ago
who actually provide these answers? why are there so many wrong and misleading answers out here
upvoted 8 times
rrongcheng
4 years, 9 months ago
By all those kind people who capture those questions for us and help us a LOT!!!!
upvoted 3 times
...
...
nadsayyed
Most Recent 4 years, 1 month ago
I think B and C is correct answer as SearchServiceClient is used to search the index while SearchIndexClient is used to create and delete it. The Indexes Properties within SearchServiceClient object is only used to get the indexes please refer - https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.search.searchserviceclient?view=azure-dotnet#properties SearchIndexClient is used to create indexes please refer - https://docs.microsoft.com/en-us/azure/search/search-get-started-dotnet#create-a-search-client https://docs.microsoft.com/en-us/azure/search/search-get-started-dotnet#create-a-search-client
upvoted 1 times
...
monniq
4 years, 3 months ago
Looks like this question relates to an older version of the Azure Search service. According to this article, SearchCredentials object is passed to the SearchIndexClient. https://www.skylinetechnologies.com/Blog/Skyline-Blog/April_2018/how-to-use-azure-search-services
upvoted 1 times
...
bugimachi
4 years, 4 months ago
It seems that the API has been updated to Version 11: https://docs.microsoft.com/en-us/azure/search/search-howto-dotnet-sdk In V11, there is neither a SearchServiceClient, nor a SearchCredentials class anymore -- the page mentions "SearchIndexClient" only...
upvoted 1 times
bugimachi
4 years, 4 months ago
Oh sorry, I was wrong. It has this line to query: SearchClient searchClient = new SearchClient(new Uri(searchServiceEndPoint), indexName, new AzureKeyCredential(queryApiKey));
upvoted 2 times
...
...
Cornholioz
4 years, 4 months ago
"Create the object" which is "used to create indexes" - I'll go with A & C. Search Credentials and SearchServiceClient
upvoted 1 times
...
MrMohan
4 years, 8 months ago
Answer - A & C
upvoted 1 times
...
ExamStudent123
4 years, 9 months ago
A and C are correct. Here is how to do it with just SearchServiceClient and SearchCredentials: var serviceClient = new SearchServiceClient(searchServiceName, new SearchCredentials(adminApiKey)); var definition = new Index() { Name = indexName, Fields = FieldBuilder.BuildForType<Hotel>() }; serviceClient.Indexes.Create(definition);
upvoted 3 times
...
Wadda
4 years, 9 months ago
Correct Answer is C and D, I checked same question in WizLab
upvoted 1 times
...
AK89
4 years, 11 months ago
Correct Answer surely is : A and C SearchServiceClient serviceClient = new SearchServiceClient(searchServiceName, new SearchCredentials(adminApiKey));
upvoted 1 times
...
Mvii
5 years ago
SearchServiceClient - creates indexes. SearchIndexClient - populates indexes. SearchCredentials are required to construct both. You can create SearchIndexClient by using SearchServiceClient. Answer - A & C.
upvoted 6 times
...
heero
5 years, 2 months ago
A & C are correct
upvoted 3 times
...
WilsonShen
5 years, 2 months ago
C and A
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago