- [Instructor] Here's an example of the Query Parameters. Now if you're using C# or node.js or even Java you may not actually ever see what the API looks like but it's a good idea to understand so that a lot of times when you are debugging, you know what you should expect. So in this case, you can see we have a query on indexes and index name, in this case, it could be accounts and then we have slash docs and then we have query parameters and you can see there's a lot of these query parameters right here.
The first one is search, and then it could be any string that you're trying to search on, then you have searchMode which could be any or all and then you can have searchFields. You want to search on these particular fields. You can say comma separater values of those particular fields. And then we'll talk about skip, top and count when it comes to pagination and then you can also specify select. That means you only want to select last name and first name even though it's a big account index, you don't want any other property or you may just want the email but that's in $select.
And then you can order by, whatever value you think you wan to categorize your data by, you can use an orderby clause and we'll talk about facets later. ScoringProfile is boosting, we can also highlight with a pre-tag or a post-tag for a particular field. Here's an example of pagination. As you can see, it says, "Gimme the top 10 records "in the first hall" and says, "skip only zero." That means give me the first 20 records and then the next call, it says, "Give me the top 20 records "after skipping the first 20" and if you look at the third call, it says, "give me the top 20 records after skipping "the first 40 records." So this way, we've got the top 60 records and this is how pagination works and by default, it's getting sorted by the score which is your boosting score.
Which we'll see an example later in the course. Here's an example of a simplified index structure. The name of the index happens to be accounts and then we have account number which is of type string and it also says key is true. The next one is named balance which is of type Edm.String. If it is account balance, it makes sense to make it Edm.double and I could have also said, filterable is true. And we can do that for any of this and this is how we define the schema of an index and if you notice, there's something called suggestors and suggesters can only apply on a string or an Edm collection of string field.
In this case, I'm calling the suggester nameSuggester. I could have called it anything I'd like and it has source fields as first name and last name and you can see first name and last name happen to be strings and then I have a mode which is analyzingInfixMatching which is one of the modes that are supported by a suggester. Good news about linguistics is that as your search has support for 50 languages, one thing to keep in mind is that a lot of practices for English may not be the best practices for French or German and with every different language, different things need to be kept in mind.
Most of this work should be done by the search engine which in this we're lucky to have as you search take care of that for us rather than having to do it on our own. It supports all the well-known Lucene analyzers and stemmers. At the same time, it also has some of the Microsoft Analyzers that are used by the natural language processing stack, also part of Office, Bing and Cortana teams that have created these analyzers are part of Azure search now.
When it comes to indexing data, we can push to the indexes where we have name, which is a name of an index but it will only take about a thousand actions per batch. So a batch is about a thousand actions and then if you want more than thousand actions, and an action could be upload, merge, delete or pretty much anything. Well, that batch, it could be simply like insertions. Right, if you want to insert 900 records and update another 100 records, you can only do a thousand at one point in time when it comes to a batch.
And most of the times, there should be a web job in the background, in an Azure environment that takes care of batching operations or actions to Azure search. At the same time, you can also use indexers. So for example, your data lies in Azure SQL DB or Document DB, you can actually create a policy per data source and then it will automatically detect the change in that particular data source and then act upon it and it can also delete things.
For example, you have a record which is accounts and it lies in an Azure SQL DB instance and someone went and deleted that account. Well, automatically, the indexer will detect that particular change and then delete the pertaining records in Azure search. So this is super cool. Keep in mind, Azure search is more like a service so we have APIs which are the management APIs, we can also go to the portal to access the same information but we also have the management APIs that will allow us to look at the capacity that we're using, what capacity we're left with, what kind of billing we're looking at an authentication and other options that we just looked at.
Depending on the option that you pick, you can use one or more indexes in Azure search and then your service name is going to be at the API root URL and it will be your service name .search.windows.net.
- Querying and indexing
- Creating a search service
- Using APIs during searching
- Importing JSON data
- Handling synonyms
- Working with suggestors and facets