Join Chander Dhall for an in-depth discussion in this video Documents and simple query, part of Azure Search for Developers.
- [Instructor] So here is an example of an HTTPS call. As you can see we have https and then we the search index name. In this case we can take Catzon.search.windows.net. And then we have indexes slash the name of the index. Let's say something like, accounts. And then you have docs slash index and we have the API version. You can see we also have a body, in this case we have a complete index. 865 happens to be a unique value, in that particular index.
So that's the key and we can have balance, which is $10,574. In that particular account and then we have the first name, last name, address, email and other information for that particular user. So as you can see it's a very simple json array, inside the value and we're just passing one value at this point in time. And once we created an index and the index has some documents, this is an example of being able to query it.
As you can see the plus operator is more like an and. So what I'm looking for at this point of time with an and operation is, looking for two things. It has to have Cazton and then it has to have Developers. So any document that has that value will be picked. Now we have or, where I'm saying, "Give me any document that has at least one of the two." Which is either Cazton or Developers. And if you see not, it's a different kind of syntax. It's a minus sign here, so it's Cazton minus Developers.
So what I want to have is a document that has Cazton but also does not have Developer. And star is very simple. We've all used it, all the time. Anything behind z doesn't really matter, this becomes more like a fuzzy query. And then we have a phrase. In this case, you can see, if the document has the exact phrase, Cazton Developers, with a space in between, only then I should get a result back. And then it also supports the OData Filters.
And you can use comparison operators, like eq, ne, gt, lt and if you've used OData, that's really neat, because it's very easy to use. Especially with .net and a lot of .net developers use OData. And it also has collection filters as well as geospatial filters. Which comes in handy. Especially if your data is geospatial. So at the level of the document we can do a lot of things. One is, we can simply search the document. Given some of the conditions we've talked about.
And a lot more. And then we can also have more like a auto complete or a type ahead. And that's what a suggester is for. We'll look into some of these examples a little later. And we can do a lookup which could be specifically based on the ID or the key of that particular document. And we can also do a count. We use count when it comes to paging.
- Querying and indexing
- Creating a search service
- Using APIs during searching
- Importing JSON data
- Handling synonyms
- Working with suggestors and facets