Skip to content

Stage 2, Build the index ​

At a glance ​

Start stateEnd stateFallback baseline
Schema sketch from Stage 1A tNN-pNN-corporate-index on your team service, already loaded with the archiveStage 2 base index

Learning goals ​

  • Create an index with the right field attributes for the archive.
  • Understand key, searchable, filterable, facetable, sortable, and retrievable in practice.
  • Name your index with your personal namespace prefix so it never collides with a teammate.

Why it matters ​

The index is the foundation of everything that follows. A correct schema here means ingestion, search, enrichment, and Foundry IQ all work without rework. The Import data wizard builds the index, its data source, and its indexer in one pass, and the attribute decisions you make on its Preview mappings step, per field, via Configure field, are exactly the decisions you would make building the index by hand.

What you will build ​

A search index named tNN-pNN-corporate-index on your team Search service, with fields for recordId, recordType, branch, department, date, subject, and content. You build it with the Import data wizard, which also creates a data source and an indexer in the same run and immediately loads the archive; Stage 3 opens those two resources and walks through what the wizard did.

Knowledge-share outline ​

  1. What an Azure AI Search index is and how a field's attributes control its behavior.
  2. The six attributes: key (the unique id), searchable (full-text), filterable (exact filter), facetable (counts for grouping), sortable (orderby), retrievable (returned in results).
  3. Why every object you create is prefixed with your tNN-pNN namespace, and why that is collision-avoidance, not a security boundary (your team's isolation is the separate Search service).
  4. How the wizard's Preview mappings step renames fields into your schema (id to recordId, createdAt to date), and why that rename is the field mapping you would otherwise write by hand; and how each field's Configure field panel is where you set the same searchable/filterable/facetable/sortable/retrievable attributes you would set by hand.

Lab steps ​

The workshop is portal-first. Use the version-controlled template as your source of truth and enter the same values in the portal.

1. Open the Import data wizard ​

In the Azure portal, open your team resource group and your Search service (the exact names are on your onboarding page). On the Overview page, select Import data.

2. Connect to your data ​

  • Data source type: select the Azure Blob Storage tile.
  • Scenario: on What scenario are you targeting?, select Keyword search (ingest text for keyword search, optionally add AI skills later). We add AI enrichment deliberately in Stage 5, so skip RAG and Multimodal RAG here.
  • Storage account: select the one storage account offered in the picker. Your onboarding access grants Reader on exactly that one shared account, so it should be the only option listed (if it says No storage accounts found, see Troubleshooting).
  • Container: archive.
  • Parsing mode: JSON array (the archive is one JSON file containing an array of records).
  • Connection: choose the identity-based connection so your team Search service's system-assigned managed identity reads the container; no key required.

Select Next. You will look at this data source in detail in Stage 3; for now, just get the connection right.

3. Skip AI enrichment ​

The next step, Apply AI enrichments, shows Enrich your data (Optional) with tiles for Extract phrases, Extract entities, and Split text. Leave all three unselected and select Next: Stage 5 builds this enrichment deliberately, one skill at a time.

4. Fix the index field mappings ​

The next step, Preview mappings, shows Preview index fields: one row per field, each with a Source column, a Target index field name, and a Target index field type. Alongside our seven archive fields (id, recordType, branch, department, createdAt, subject, content), the wizard also lists several auto-generated blob metadata fields (metadata_storage_name, metadata_storage_path, AzureSearch_DocumentKey, and others). metadata_storage_path is mapped to a target field named id and is marked as the key.

Each row also has a ··· menu at the end; select Configure field there to open a panel with Searchable, Filterable, Facetable, Sortable, and Retrievable checkboxes for that field, plus its type and key setting. Use it to set every attribute deliberately as you go through the fields below, rather than leaving it to chance.

Fix the resulting name collision and confirm the key:

  1. Rename your own id row's Target index field name to recordId. Until you do, the wizard flags Target field name must be unique, because metadata_storage_path is already mapped to a target field also named id.
  2. Look at the small key icon in the left-most column: it must be on the recordId row (your own id field), not on the metadata_storage_path row. Because parsing mode is JSON array, every record in the archive comes from the same blob, so metadata_storage_path is identical for every record and cannot serve as the key. If the icon is on the wrong row, select Configure field on metadata_storage_path and clear Key, then select Configure field on recordId and check Key instead. Get this right before you finish the wizard: if the key stays on metadata_storage_path, every record collapses into a single document (indexer history reports all records "succeeded", but the index ends up with a document count of 1 instead of the full archive).
  3. Rename createdAt's target field name to date and change its type to Edm.DateTimeOffset.
  4. The blob metadata fields you don't need, such as AzureSearch_DocumentKey, metadata_storage_content_type, metadata_storage_size, metadata_storage_last_modified, metadata_storage_content_md5, and metadata_storage_file_extension, can be selected and Deleted. title (from metadata_storage_name) and id (from metadata_storage_path) cannot be deleted; leave them, they're harmless extra retrievable fields and do not affect the seven you care about. You can also select Hide auto-generated fields to declutter the view without deleting anything.

Renaming id to recordId and createdAt to date here is the field mapping: the wizard writes the corresponding fieldMappings entries into the indexer it creates for you, so there is no separate mapping step later.

This is the schema you're aiming for; set these attributes now with each field's ··· > Configure field panel. Retrievable defaults to off for every field except the key, so check it explicitly wherever it's listed below, or later stages won't be able to select that field back out of a query:

Field (rename from)TypeKeyAttribute goal
recordId (rename from id)Stringyesretrievable
recordTypeStringnoretrievable, filterable, facetable
branchStringnoretrievable, filterable, facetable, searchable
departmentStringnoretrievable, filterable, facetable, searchable
date (rename from createdAt)DateTimeOffsetnoretrievable, filterable, sortable
subjectStringnoretrievable, searchable
contentStringnoretrievable, searchable

That gives you "only Scranton complaints", "group by department", and "newest first" once the index is populated.

branch and department must be searchable, even though they are categories

A field can carry several attributes at once, and these two need searchable on top of filterable and facetable. In Stage 4 you name them as the keyword fields of a semantic configuration, and Azure requires every field in a semantic configuration to be searchable and retrievable; it rejects the index update otherwise.

Get it right here, because searchable is one of the attributes you cannot change on a field that already exists. Missing it means deleting and recreating the index at Stage 4, with an hour of workshop left and no slack in the budget.

The index name itself is set later, on the Review and create step.

The version-controlled template mirrors this target schema, so you can check your Configure field choices against it:

starter/2/index.json

json
{
  "name": "branch",
  "type": "Edm.String",
  "key": false,
  "searchable": false,
  "filterable": false,
  "facetable": false,
  "sortable": false,
  "retrievable": true
}
json
{
  "name": "branch",
  "type": "Edm.String",
  "key": false,
  "searchable": true,
  "filterable": true,
  "facetable": true,
  "sortable": false,
  "retrievable": true
}

5. Advanced settings ​

The next step, Advanced settings, has three sections; leave all three at their defaults for this workshop:

  • Advanced ranking and relevancy: leave Enable semantic ranker checked.
  • Schedule indexing: leave Schedule set to Once.
  • Encryption: leave Encryption type set to Microsoft-managed keys.

Select Next.

6. Review and create ​

The last step, Review and create, summarizes the data source, index, and indexer the wizard is about to create. Find the index's name field and enter it exactly as:

tNN-pNN-corporate-index

Replace tNN-pNN with your own namespace (for example t01-p01). The index carries this name exactly, with nothing appended, so this is the one place your namespace prefix has to be typed correctly.

Select Create. The wizard creates the data source, index, and indexer together and runs the indexer immediately, so your index already contains the archive by the time this stage ends. Stage 3 opens the data source and indexer the wizard just created and checks the mappings and the run.

7. Confirm the index attributes ​

Open your new index under Indexes and select the Fields tab. Confirm it matches what you set in step 4's Configure field panels: recordId the key, subject, content, branch and department searchable, and recordType/branch/department/date filterable (plus facetable or sortable as listed). If something is wrong, fix it now. Several field attributes cannot be changed once an index holds data, and the wizard has already loaded the archive, so a mistake here means deleting and recreating rather than editing.

Expected output ​

Your Search service lists tNN-pNN-corporate-index with the seven archive fields you care about, plus the title field the wizard adds and will not let you delete (eight in total). If you left the id row mapped from metadata_storage_path in place, you have nine instead; that is harmless, as long as the key is on recordId. recordId is the key, subject, content, branch and department are searchable, and your categorical fields are filterable and facetable. Because the wizard ran the indexer immediately, the document count already reads 132 (the full archive); a count of 1 means the key ended up on the wrong field, and you confirm and troubleshoot that run in Stage 3.

Checkpoint ​

index-ready: tNN-pNN-corporate-index exists with searchable subject, content, branch and department, and at least branch, department, and recordType filterable and facetable. A document count of 132 at this point is expected (1 means the key is on the wrong field); Stage 3 is where you verify that run in detail.

Fallback baseline ​

If the wizard defeats you, build the index by hand from the version-controlled definition. This is a portal action; nothing to install.

  1. On your Search service, select Indexes > Add index > Add index (JSON).
  2. Open baseline/2/index.json and copy the definition object (the part with "name" and "fields").
  3. Paste it into the JSON editor, then replace every {{namespace}} placeholder with your own tNN-pNN (so the name becomes, for example, t01-p01-corporate-index).
  4. Select Save to create the index.

That gives you the right schema, but not the data: you still need the data source and the indexer, so re-run the Import data wizard and point it at the index you just created, or ask your facilitator for a hand.

Troubleshooting ​

  • The index name is rejected. Names must be lowercase and start with a letter. Use your exact tNN-pNN-corporate-index.
  • You cannot create an index. Confirm your validation panel shows the Workshop Search Developer role. If access is still propagating, wait a minute and retry.
  • You set the wrong attribute. Some attributes cannot be changed after creation. If you need to change key, searchable, or filterable, delete and recreate the index (fast at this stage) or apply the Stage 2 baseline.
  • Indexer succeeds but the index's document count is far lower than the archive (for example, 1). The key is still mapped from metadata_storage_path instead of recordId; every record in the JSON array shares the same blob path, so each one overwrites the last. The indexer's execution log shows a Warning: "This indexer is configured for a one-to-many parsing mode. The index key is also mapped from property 'metadata_storage_path' ... These two configurations are in conflict." There is no fix after the fact: delete the indexer, index, and data source, then redo the wizard, making sure recordId (not the metadata_storage_path-derived field) is the key before you select Create.

Optional stretch ​

Add a retrievable-only client field now if you like, but leave it unmapped; the wizard's indexer only fills the seven core fields. Not required for any later stage.

What we will not cover ​

  • Vector fields and vector search configuration; the optional Stage 8 stretch adds them to this same index later.
  • Index aliases and zero-downtime reindexing (a production concern beyond this two-hour path).