When submitting search requests to Azure Search, there are a number of parameters that can be specified alongside the actual words that are typed into the search box of your application. These query parameters allow you to achieve some deeper control of the full-text search experience.
Below is a list that briefly explains common uses of the query parameters in Azure Search. For full coverage of query parameters and their behavior, please see the detailed pages for the REST API and .NET SDK.
Types of queries
Azure Search offers many options to create extremely powerful queries. The two main types of query you will use are
search query searches for one or more terms in all searchable fields in your index, and works the way you would expect a search engine like Google or Bing to work. A
filter query evaluates a boolean expression over all filterable fields in an index. Unlike
filter queries match the exact contents of a field, which means they are case-sensitive for string fields.
You can use searches and filters together or separately. If you use them together, the filter is applied first to the entire index, and then the search is performed on the results of the filter. Filters can therefore be a useful technique to improve query performance since they reduce the set of documents that the search query needs to process.
Simple query syntax
The simple query syntax is the default query language used in Azure Search. The simple query syntax supports a number of common search operators including the AND, OR, NOT, phrase, suffix, and precedence operators.
Lucene query syntax
Using this query syntax allows you to easily achieve the following capabilities: Field-scoped queries, fuzzy search, proximity search, term boosting, regular expression search, wildcard search, syntax fundamentals, and queries using boolean operators.
When receiving results for a search query, you can request that Azure Search serves the results ordered by values in a specific field. By default, Azure Search orders the search results based on the rank of each document's search score, which is derived from TF-IDF.
If you want Azure Search to return your results ordered by a value other than the search score, you can use the
orderby search parameter. You can specify the value of the
orderby parameter to include field names and calls to the
geo.distance() function for geospatial values. Each expression can be followed by
asc to indicate that results are requested in ascending order, and
desc to indicate that results are requested in descending order. The default ranking ascending order.
Azure Search makes it easy to implement paging of search results. By using the
skip parameters, you can smoothly issue search requests that allow you to receive the total set of search results in manageable, ordered subsets that easily enable good search UI practices. When receiving these smaller subsets of results, you can also receive the count of documents in the total set of search results.
You can learn more about paging search results in the article How to page search results in Azure Search.
In Azure Search, emphasizing the exact portion of search results that match the search query is made easy by using the
highlightPostTag parameters. You can specify which searchable fields should have their matched text emphasized as well as specifying the exact string tags to append to the start and end of the matched text that Azure Search returns.
Try out query syntax
The best way to understand syntax differences is by submitting queries and reviewing results.