Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Azure icon
Labs

Extract Key Terms from Free Text Using Azure AI Search

In this hands-on experience, you will get a chance to set up an AI-enhanced Azure AI Search solution, including creating the search service, importing data to generate a search index, adding a skillset to pull key terms from a description field, and add those key terms to the index. You will validate your work by searching the data using the JSON query editor in the Search Explorer and in a demo application. In the process, you will explore the use of both skillsets and some more nuanced configurations for Azure AI Search indexes. You will also get a chance to explore the JSON code "under the covers" that defines skillsets, indexes, and indexers. All work will take place in the Azure portal, and minimal coding is required to create the resources and test your solution.

Azure icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 45m
Published
Clock icon Feb 09, 2024

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Create an Azure AI Search Service

    You should already be logged into the Azure portal, using the credentials provided with the lab. When you first log in to the Azure Portal, you will land on the overview page for the resource group already deployed for you. Note the location/region for the resource group.

    Using the Azure portal, create an Azure AI Search service with the following configuration:

    • Create the service in the existing resource group, and in the same location as that resource group.
    • Use any valid name you choose.
    • Create the service in the Basic pricing tier. Do not choose the Free tier, as only one is allowed per subscription, and your lab environment is on a shared subscription with other students.
  2. Challenge

    Import Data and Add Skillset to Extract Key Terms

    In this objective, you will complete the tasks required to import sample data and build an index on your search service, based on that data. The indexer that populates the index will also include a skillset that pulls out key terms or phrases from the description provided with a hotel property listing. The purpose is to provide a richer search experience for website users and individuals on the data backend responsible for metadata and tagging.

    You should have already created an Azure AI Search service. Navigate to the newly deployed service, and on the "Overview" page, select "Import Data" to kick off the wizard. Let the wizard guide you through the process, including the following specific details and properties.

    • Import from the existing "Samples" provided by Microsoft and choose the CosmosDB dataset called "hotels-sample."
    • Under Add cognitive skills, Attach AI Services, confirm that the AI Services Resource Name is "Free (Limited enrichments)." This setting determines the compute resource that will be used to power the AI enrichment(s) you select. The free option allows you to use non-billed resources instead of setting up and paying for compute and storage — on an Azure AI multi-service resource.
    • Under Add Enrichments you should add a new enrichment using the description field as your source data field, and the enrichment you want to apply should pull key phrases from the text in the description field and populate a new field, called keyphrases. All other features on the Add cognitive skills tab can remain at their defaults.
    • Under Customize target index, familiarize yourself with the fields extracted from the source data, but don't change any of the configurations for those fields. You will alter only the keyphrases field you added as a part of the skillset.
    • Take note that the keyphrases field is typed as a collection, so the extracted terms will be gathered in an array. Alter the configuration of the keyphrases field so that each of these features are enabled, if they are not already: Retrievable, Filterable, Facetable, Searchable.

      NOTE: You cannot sort on a collection, so neither our new field, nor tags includes an option to sort.

    • In the final step of the wizard, you can complete creating the index, the key phrases skillset, and the indexer -- and kick it off the first indexer run by selecting Submit.
    • When the indexer run is complete, navigate to the index populated by the indexer and note the number of JSON documents created and the storage size. There should be 20 documents, each containing the data related to a single hotel property. There are actually many more documents in the sample data source, but the indexer run times out at 20 documents intentionally. This is because you chose "Free (Limited enrichments)" as your AI Services Resource in the wizard. Having only 20 documents is suitable for demo and testing purposes.
    Tip: If the UI Indicates 0 Documents and 0 Bytes

    If the UI in the index screen appears to indicate that there are no documents, make sure the indexer has completed running. However, there may also be a quirk in the UI. You can also perform a quick query by putting an asterisk (*) in the search bar and running the query. If the query returns documents, the UI just hasn't caught up with the underlying data statistics; you can proceed with the next objective.

  3. Challenge

    Verify Output of Key Term Extraction

    Context: For this objective, you should already be on the index page for your search index, which defaults to the Search Explorer pane.

    Browse the index data with Search Explorer

    Using the Search Explorer, browse the index to examine the output of the data source data, as well as the keyphrases field that stores the extracted terms from the description column.

    Tip: To see all 20 documents, simply execute a search with nothing or a * in the search bar. Keep in mind that only the English description column is used to create the list of key phrases.

    Browse the index data with a Sample Application

    Note: You need to be allowed to download a simple HTML page to your local environment to use the sample application.

    1. Select Create Demo App and choose to "Enable CORS and continue" when prompted.

    2. Configure the app, which mostly involves selecting how to handle a few fields and letting everything else default.

    3. When you are done configuring the Individual result, the Sidebar and the Suggestions, select Create the Demo App to generate an HTML file you will confirm for download to your local environment. Open that file to browse your index data in the demo app.

    4. As you explore the demo app, notice that as you make selections on the faceted fields in the sidebar, the values of the other faceted fields change.

      Tips: When configuring the sample application, under Individual result ignore the Thumbnail setting and select two fields for the title and description to display in the search results (HotelName and descriptionare resonable choices). Make sure the keyphrases field is configured to appear in the sidbar; add it, if it is not. If you do not see keyphrases in the list of fields to put in the sidebar, then you probably forgot to make it filterable and facetable when defining the index. Only the required settings are mentioned in this objective; feel free to leave the rest of the app configuration defaulted.

  4. Challenge

    Optional Exploration of Search Assets

    Context: For this optional exploration, you should already be in the index page for your search index, which defaults to the Search Explorer pane.

    You created three assets in the "Import Data" process:

    • A search index that stores the searchable data
    • An indexer that populates the index, either manually or on a schedule
    • A skillset that is attached to an indexer and represents a pipeline of one or more AI skills the indexer can apply to the data prior to populating or updating the index.

    While the wizard is a handy way to create these assets, they are commonly created directly in JSON, either with templates or from scratch.

      • From the current index page, you can select Edit JSON to examine the JSON that defines the index. When you are done exploring, close the window without editing.
      • Return to the Overview page for the Azure AI Search service you created and click on Indexers in the left menu. Select the indexer you just created and click on Indexer Definition (JSON) to examine the JSON that defines the indexer. Notice the parameters near the top that associate the indexer with the data source name, the targeted index, and the skillset associated with the indexer, if any. When you are done exploring return to the search service Overview page without modifying the indexer.
      • Click on Skillsets in the left menu, and select your skillset to get a sense of how individual skills are defined and applied within a broader skillset. When you are done exploring, return to the search service Overview page without modifying the JSON.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans