How to use filter parameter while using own data with data source - Azure AI Search

Apoorv Shrivastava (MINDTREE LIMITED) 20 Reputation points Microsoft External Staff
2024-03-01T06:34:53.0866667+00:00
  1. - Requesting for explanations about how to use filter parameter while using own data with data source within Azure OpenAI with Azure AI search.
    • Requesting for help on how to add a custom field while adding data to Azure search via ingestion job
    We are using azure ai search for azure openai, we are not using azure search directly ,it is being used by the chatgpt models. we are using it only to provide our own data to chatgpt.
    1. Our data is PDF, what we are basically doing is that uploading the file to azure storge container and invoke an ingestion job (Link), Which fetch the files from storage container and extract it and the feed the information to an azure search index. (the index also automatically created by the ingestion job, we do not have any control over the index and the fields inside it being created in the background as well as the fields created).
  2. The given documentation is completely based on creating from UI portal which we are not looking for, we are looking for a REST method.
Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
1,339 questions
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
4,081 questions
{count} votes

Accepted answer
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2024-03-05T11:50:06.88+00:00

    @Apoorv Shrivastava (MINDTREE LIMITED) ,

    For the filter parameter, you could include the filter in the request to the On Your Data service by adding it to the Azure Search data source parameters. 

    You may find the filter parameter usage in the API documentation here: 
    Data source - Azure AI Search | parameters

    Just to clarify, could you please let us know what custom fields are you looking to include in the index?

    Edit:

    Currently, custom fields mapping is not supported for IngestionREST API, our PG is actively working on this feature, but there is no ETA to share on this yet.

    I have relayed this feedback to our product engineering team.

    (I have converted comment to answer)


    If the answer helped (pointed you in the right direction) > please click Accept Answer


1 additional answer

Sort by: Most helpful
  1. Tcstrackings 5 Reputation points
    2024-03-05T14:31:00.8833333+00:00

    You need to ensure that your data is indexed correctly and that you have defined the fields you want to filter on as either filterable or facetable in your index schema. Once your data is indexed, you can use the filter parameter in your search queries to include or exclude documents based on specific criteria.

    Use the filter parameter in your search query by passing the filter expression. You can send this query using either a GET or POST request to the Azure AI Search service. For example, HTTP GET https://[service-name].search.windows.net/indexes/[index-name]/docs?search=*&$filter=status eq 'active'&api-version=2020-06-30 Or, if you're using the Azure SDK, you might write something like csharp var options = new SearchOptions() { Filter = "status eq 'active'" }; var results = searchClient.Search<YourModel>("*", options);


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.