Quickstart: Create an Azure Cognitive Search index in the Azure portal

In this quickstart, you'll create your first search index using the Import data wizard and a built-in sample data source consisting of fictitious hotel data. The wizard guides you through the creation of a search index (hotels-sample-index) so that you can write interesting queries within minutes.

Although you won't use the options in this quickstart, the wizard includes a page for AI enrichment so that you can extract text and structure from image files and unstructured text. For a similar walkthrough that includes AI enrichment, see Quickstart: Create a skillset.


Check for space

Many customers start with the free service. The free tier is limited to three indexes, three data sources, and three indexers. Make sure you have room for extra items before you begin. This quickstart creates one of each object.

Check the service overview page to find out how many indexes, indexers, and data sources you already have.

Screenshot of lists of indexes, indexers, and data sources in the service dashboard.

Create and load an index

Search queries iterate over an index that contains searchable data, metadata, and other constructs that optimize certain search behaviors.

For this quickstart, we'll create and load the index using a built-in sample dataset that can be crawled using an indexer via the Import data wizard. The hotels-sample data set is hosted on Microsoft on Azure Cosmos DB and accessed over an internal connection. You don't need your own Cosmos DB account or source files to access the data.

An indexer is a source-specific crawler that can read metadata and content from supported Azure data sources. Normally, indexers are created programmatically, but in the portal, you can create them through the Import data wizard.

Step 1 - Start the Import data wizard and create a data source

  1. Sign in to the Azure portal with your Azure account.

  2. Find your search service and on the Overview page, select Import data on the command bar to create and populate a search index.

    Screenshot of the Import data command in the command bar.

  3. In the wizard, select Connect to your data > Samples > hotels-sample. This data source is built-in. If you were creating your own data source, you would need to specify a name, type, and connection information. Once created, it becomes an "existing data source" that can be reused in other import operations.

    Screenshot of the select sample dataset page in the wizard.

  4. Continue to the next page.

Step 2 - Skip the "Enrich content" page

The wizard supports the creation of an AI enrichment pipeline for incorporating the Cognitive Services AI algorithms into indexing.

We'll skip this step for now, and move directly on to Customize target index.

Screenshot of the Skip cognitive skill button in the wizard.


You can step through an AI-indexing example in a quickstart or tutorial.

Step 3 - Configure index

For the built-in hotels sample index, a default index schema is defined for you. Except for a few advanced filter examples, queries in the documentation and samples that target the hotel-samples index will run on this index definition:

Screenshot of the generated hotels index definition in the wizard.

Typically, in a code-based exercise, index creation is completed prior to loading data. The Import data wizard condenses these steps by generating a basic index for any data source it can crawl. Minimally, an index requires a name and a fields collection. One of the fields should be marked as the document key to uniquely identify each document. Additionally, you can specify language analyzers or suggesters if you want autocomplete or suggested queries.

Fields have a data type and attributes. The check boxes across the top are attributes controlling how the field is used.

  • Key is the unique document identifier. It's always a string, and it's required. Only one field can be the key.
  • Retrievable means that field contents show up in search results list. You can mark individual fields as off limits for search results by clearing this checkbox, for example for fields used only in filter expressions.
  • Filterable, Sortable, and Facetable determine whether fields are used in a filter, sort, or faceted navigation structure.
  • Searchable means that a field is included in full text search. Strings are searchable. Numeric fields and Boolean fields are often marked as not searchable.

Storage requirements can vary as a result of attribute selection. For example, Filterable requires more storage, but Retrievable doesn't.

By default, the wizard scans the data source for unique identifiers as the basis for the key field. Strings are attributed as Retrievable and Searchable. Integers are attributed as Retrievable, Filterable, Sortable, and Facetable.

  1. Accept the defaults.

    If you rerun the wizard a second time using an existing hotels data source, the index won't be configured with default attributes. You'll have to manually select attributes on future imports.

  2. Continue to the next page.

Step 4 - Configure indexer

Still in the Import data wizard, select Indexer > Name, and type a name for the indexer.

This object defines an executable process. You could put it on recurring schedule, but for now use the default option to run the indexer once, immediately.

Select Submit to create and simultaneously run the indexer.

Screenshot of the hotels indexer definition in the wizard.

Monitor progress

The wizard should take you to the Indexers list where you can monitor progress. For self-navigation, go to the Overview page and select the Indexers tab.

It can take a few minutes for the portal to update the page, but you should see the newly created indexer in the list, with status indicating "in progress" or success, along with the number of documents indexed.

Screenshot of the indexer progress message in the wizard.

Check results

The service overview page provides links to the resources created in your Azure Cognitive Search service. To view the index you just created, select Indexes from the list of links.

Wait for the portal page to refresh. After a few minutes, you should see the index with a document count and storage size.

Screenshot of the Indexes list on the service dashboard.

From this list, you can select on the hotels-sample index that you just created, view the index schema. and optionally add new fields.

The Fields tab shows the index schema. If you're writing queries and need to check whether a field is filterable or sortable, this tab shows you the attributes.

Scroll to the bottom of the list to enter a new field. While you can always create a new field, in most cases, you can't change existing fields. Existing fields have a physical representation in your search service and are thus non-modifiable, not even in code. To fundamentally change an existing field, create a new index, dropping the original.

Screenshot of the sample index definition in Azure portal.

Other constructs, such as scoring profiles and CORS options, can be added at any time.

To clearly understand what you can and can't edit during index design, take a minute to view index definition options. Grayed-out options are an indicator that a value can't be modified or deleted.

Query using Search explorer

You now have a search index that can be queried using Search explorer.

Search explorer sends REST calls that conform to the Search Documents API. The tool supports simple query syntax and full Lucene query parser.

  1. Select Search explorer on the command bar.

    Screenshot of the Search Explorer command on the command bar.

  2. From Index, choose "hotels-sample-index".

    Screenshot of the Index and API selection lists in Search Explorer.

  3. In the search bar, paste in a query string from the examples below and select Search.

    Screenshot of the query string text field and search button in Search Explorer.

Run more example queries

All of the queries in this section are designed for Search Explorer and the Hotels sample index. Results are returned as verbose JSON documents. All fields marked as "retrievable" in the index can appear in results. For more information about queries, see Querying in Azure Cognitive Search.

Query Description
search=spa Simple full text query with top N results. The search= parameter is used for keyword search, in this case, returning hotel data for those containing spa in any searchable field in the document.
search=beach &$filter=Rating gt 4 Filtered query. In this case, ratings greater than 4.
search=spa &$select=HotelName,Description,Tags &$count=true &$top=10 Parameterized query. The & symbol is used to append search parameters, which can be specified in any order.
$select parameter returns a subset of fields for more concise search results.
$count=true parameter returns the total count of all documents that match the query.
$top=10 returns the highest ranked 10 documents out of the total. By default, Azure Cognitive Search returns the first 50 best matches. You can increase or decrease the amount using this parameter.
search=* &facet=Category &$top=2 Facet query, used to return an aggregated count of documents that match a facet value you provide. On an empty or unqualified search, all documents are represented. In the hotels index, the Category field is marked as "facetable".
search=spa &facet=Rating Facet on numeric values. This query is facet for rating, on a text search for "spa". The term "Rating" can be specified as a facet because the field is marked as retrievable, filterable, and facetable in the index, and its numeric values (1 through 5) are suitable for grouping results by each value.
search=beach &highlight=Description &$select=HotelName, Description, Category, Tags Hit highlighting. The term "beach" will be highlighted when it appears in the "Description" field.
search=seatle followed by
search=seatle~ &queryType=full
Fuzzy search. By default, misspelled query terms, like seatle for "Seattle", fail to return matches in typical search. The first example returns no results. Adding queryType=full invokes the full Lucene query parser, which supports the ~ operand for fuzzy search.
$filter=geo.distance(Location, geography'POINT(-122.12 47.67)') le 5 &search=* &$select=HotelName, Address/City, Address/StateProvince &$count=true Geospatial search. The example query filters all results for positional data, where results are less than 5 kilometers from a given point, as specified by latitude and longitude coordinates (this example uses Redmond, Washington as the point of origin).


This quickstart provided a quick introduction to Azure Cognitive Search using the Azure portal.

You learned how to create a search index using the Import data wizard. You created your first indexer and learned the basic workflow for index design. See Import data wizard in Azure Cognitive Search for more information about the wizard's benefits and limitations.

Using the Search explorer in the Azure portal, you learned some basic query syntax through hands-on examples that demonstrated key capabilities such as filters, hit highlighting, fuzzy search, and geospatial search.

Clean up resources

When you're working in your own subscription, it's a good idea at the end of a project to identify whether you still need the resources you created. Resources left running can cost you money. You can delete resources individually or delete the resource group to delete the entire set of resources.

You can find and manage resources in the portal, using the All resources or Resource groups link in the left-navigation pane.

If you're using a free service, remember that the limit is three indexes, indexers, and data sources. You can delete individual items in the portal to stay under the limit.

Next steps

Use a portal wizard to generate a ready-to-use web app that runs in a browser. You can try out this wizard on the small index you just created, or use one of the built-in sample data sets for a richer search experience.