What is an Index?
In Azure Cognitive Search, an index is a persistent store of documents and other constructs used for filtered and full text search on an Azure Cognitive Search service. Conceptually, a document is a single unit of searchable data in your index. For example, an e-commerce retailer might have a document for each item they sell, a news organization might have a document for each article, and so forth. Mapping these concepts to more familiar database equivalents: an index is conceptually similar to a table, and documents are roughly equivalent to rows in a table.
When you add or upload an index, Azure Cognitive Search creates physical structures based on the schema you provide. For example, if a field in your index is marked as searchable, an inverted index is created for that field. Later, when you add or upload documents, or submit search queries to Azure Cognitive Search, you are sending requests to a specific index in your search service. Loading fields with document values is called indexing or data ingestion.
Arriving at the right index design is typically achieved through multiple iterations. Using a combination of tools and APIs can help you finalize your design quickly.
- Determine whether you can use an indexer. If your external data is one of the supported data sources, you can prototype and load an index using the Import data wizard.
- If you can’t use Import data, you can still create an initial index in the portal, adding fields, data types, and assigning attributes using controls on the Add Index page. The portal shows you which attributes are available for different data types. If you’re new to index design, this is helpful.When you click Create, all of the physical structures supporting your index are created in your search service.
- Download the index schema using Get Index REST API and a web testing tool like Postman. You now have a JSON representation of the index you created in the portal.You are switching to a code-based approach at this point. The portal is not well suited for iteration because you cannot edit an index that is already created. But you can use Postman and REST for the remaining tasks.
- Load your index with data. Azure Cognitive Search accepts JSON documents. To load your data programmatically, you can use Postman with JSON documents in the request payload. If your data is not easily expressed as JSON, this step will be the most labor intensive.
- Query your index, examine results, and further iterate on the index schema until you begin to see the results you expect. You can use Search explorer or Postman to query your index.
- Continue using code to iterate over your design.
Because physical structures are created in the service, dropping and recreating indexes is necessary whenever you make material changes to an existing field definition. This means that during development, you should plan on frequent rebuilds. You might consider working with a subset of your data to make rebuilds go faster.
Code, rather than a portal approach, is recommended for iterative design. If you rely on the portal for index definition, you will have to fill out the index definition on each rebuild. As an alternative, tools like Postman and the REST API are helpful for proof-of-concept testing when development projects are still in early phases. You can make incremental changes to an index definition in a request body, and then send the request to your service to recreate an index using an updated schema.
Create a search index without coding
With expertrec, you can create a search index at 9$ per month without coding. Expertrec lets you create a search engine from this link.
- Go to search engine index creator.
- Login with your Gmail id.
- Enter your website URL.
- Enter your sitemap URL if you have one.
- Now the crawling and indexing of your website will start. Wait for this to complete.
- You can directly start using this search engine by adding the code to your website.