Azure AI Search Push API
Index Any Data Using Azure AI Search Push
API
The most adaptable method for adding data to an Azure
AI Search index is the REST API. Any programming language or interactive
application that can send JSON requests to an endpoint can be used.
Supported REST API Operations
There are two supported
REST APIs provided by AI Search- Search and management APIs.
How To Call Search REST API ?
If you want to call any of the search APIs you need
to:
- Use the HTTPS endpoint provided by your search service, you must include an api-version in the URI.
- The request header must include an api-key attribute.
To find the endpoint,
api-version, and api-key go to the Azure portal. In the portal, navigate to
your search service, then select Search explorer. Choose Keys to locate the
api-key on the left. If you're doing more than just accessing the index with
the REST API, you can use either the primary or secondary admin key. You can
make and use query keys if you only need to search an index. An admin key is
required in order to add, modify, or remove data from an index.
Add Data To An Index
Use an HTTP POST request
using the indexes feature. The body of your request needs to let the REST
endpoint know the action to take on the document, which document to apply the
action too, and what data to use. If your request is successful, the API will
return a 200 status code. You can add as many documents in the value array as
you want. However, for optimal performance consider batching the documents in
your requests up to a maximum of 1,000 documents, or 16 MB in total size.
Use .NET Core To Index Any
Data
How your index performs
is based on six key factors:
- The search service tier and how many replicas and partitions you've enabled.
- The complexity of the index schema. Reduce how many properties (searchable, facetable, sortable) each field has.
- The number of documents in each batch, the best size will depend on the index schema and the size of documents.
- How multithreaded your approach is.
- Handling errors and throttling. Use an exponential backoff retry strategy.
- Where your data resides, try to index your data as close to your search index. For example, run uploads from inside the Azure environment.
Conclusion
We have successfully learnt about indexing any data using
Azure AI Search push API.
Comments
Post a Comment