Use the built-in index designer in Azure portal to prototype or create a search index to run on your Azure Search service.
Find your search service
- Sign in to the Azure portal page and review the search services for your subscription
- Select your Azure Search service.
Name the index
- Click the Add index button in the command bar at the top of the page.
Name your Azure Search index.
- Start with a letter.
- Use only lowercase letters, digits, or dashes ("-").
- Limit the name to 60 characters.
The index name becomes part of the endpoint URL used on connections to the index and for sending HTTP requests in the Azure Search REST API.
Define the fields of your index
Index composition includes a Fields collection that defines the searchable data in your index. More specifically, it specifies the structure of documents that you upload separately. The Fields collection includes required and optional fields, named and typed, with index attributes to determine how the field can be used.
In the Add Index blade, click Fields > to slide open the field definition blade.
Accept the generated key field of type Edm.String. By default, the field is named id but you can rename it as long as the string satisfies naming rules. A key field is mandatory for every Azure Search index and it must be a string.
Add fields to fully specify the documents you will upload. If documents consist of an id, hotel name, address, city, and region, create a corresponding field for each one in the index. Review the design guidance in the section below for help in setting attributes.
Optionally, add any fields that are used internally in filter expressions. Attributes on the field can be set to exclude fields from search operations.
When finished, click OK to save and create the index.
Tips for adding fields
Creating an index in the portal is keyboard intensive. Minimize steps by following this workflow:
First, build the field list by entering names and setting data types.
Next, use the check boxes at the top of each attribute to bulk enable the setting for all fields, and then selectively clear boxes for the few fields that don't require it. For example, string fields are typically searchable. As such, you might click Retrievable and Searchable to both return the values of the field in search results, as well as allow full text search on the field.
Design guidance for setting attributes
Although you can add new fields at any time, existing field definitions are locked in for the lifetime of the index. For this reason, developers typically use the portal for creating simple indexes, testing ideas, or using the portal pages to look up a setting. Frequent iteration over an index design is more efficient if you follow a code-based approach so that you can rebuild the index easily.
Analyzers and suggesters are associated with fields before the index is saved. Be sure to click through each tabbed page to add language analyzers or suggesters to your index definition.
String fields are often marked as Searchable and Retrievable.
Fields used to narrow search results include Sortable, Filterable, and Facetable.
Field attributes determine how a field is used, such as whether it is used in full text search, faceted navigation, sort operations, and so forth. The following table describes each attribute.
|searchable||Full-text searchable, subject to lexical analysis such as word-breaking during indexing. If you set a searchable field to a value like "sunny day", internally it will be split into the individual tokens "sunny" and "day". For details, see How full text search works.|
|filterable||Referenced in $filter queries. Filterable fields of type
|sortable||By default the system sorts results by score, but you can configure sort based on fields in the documents. Fields of type
|facetable||Typically used in a presentation of search results that includes a hit count by category (for example, hotels in a specific city). This option cannot be used with fields of type
|key||Unique identifier for documents within the index. Exactly one field must be chosen as the key field and it must be of type
|retrievable||Determines whether the field can be returned in a search result. This is useful when you want to use a field (such as profit margin) as a filter, sorting, or scoring mechanism, but do not want the field to be visible to the end user. This attribute must be
Create the hotels index used in example API sections
Azure Search API documentation includes code examples featuring a simple hotels index. In the screenshots below, you can see the index definition, including the French language analyzer specified during index definition, which you can recreate as a practice exercise in the portal.
After creating an Azure Search index, you can move to the next step: upload searchable data into the index.
Alternatively, you could also take a deeper look at indexes. In addition to the Fields collection, an index also specifies analyzers, suggesters, scoring profiles, and CORS settings. The portal provides tabbed pages for defining the most common elements: Fields, analyzers, and suggesters. To create or modify other elements, you can use the REST API or .NET SDK.