azure-search-openai-demo icon indicating copy to clipboard operation
azure-search-openai-demo copied to clipboard

Seeking advice on configuring multiple Azure search services from different resource groups.

Open EOSG-DataDrive opened this issue 1 year ago • 4 comments

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request
- [x] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

NA

Any log messages given by the failure

NA

Expected/desired behavior

NA

OS and Version?

Windows 10

azd version?

version 1.3.0

Versions

I have a fully functioning custom app which has allows users to chat with multiple search indexes (from the same Azure search service). Is there an optimal way for connecting to search indexes in another Azure Search Service in a different resource group, however interact with it in the same app? Basically, we manage different knowledges bases in separate search services/resource groups, and are also trying to monitor and bill internal consumption separately hence the nuanced setup. If anyone else has/knows done something similar great to hear. Happy to provide more details if needed.


Thanks! We'll be in touch soon.

EOSG-DataDrive avatar Dec 20 '23 18:12 EOSG-DataDrive

Does the app need to consult each index and coalesce the results or is it based on some user data as to which index it uses?

tonybaloney avatar Dec 20 '23 22:12 tonybaloney

The user selects one or many indexes in the UI using radio buttons, therefore determines which index to use. That part is already done. Two levels of challenges i'm currently facing are below. If any advice or direction to who might have already solved, would be super grateful.

Level 1 (easier since indexes within same search client) : I've tried the following in chatreadretrieveread.py, but getting "raise HttpResponseError(response=response, model=error) azure.core.exceptions.HttpResponseError: () Index name must be non-empty." although I see that the index name was passed in the request payload and inside of selectedIndices.

class ChatReadRetrieveReadApproach(Approach):

# ... [existing methods] ...

async def run(self, messages, context, session_state):
    # Retrieve the single search client from app config
    search_client = current_app.config[CONFIG_SEARCH_CLIENT]

    # Retrieve selected indices from the context 
    selected_indices = context.get("selectedIndices", [])

    # Combine search results from selected indexes
    combined_results = []
    for index in selected_indices:
        search_client.index_name = index  # Set the index name dynamically
        results = await search_client.search_documents(query=query_text)
        combined_results.extend(results)

    # Process and return the combined results
    # ...
    

Level 2: I have 2 different search services housing multiple indexes (different resource groups and in different azure regions). Currently attempting to create multiple search clients in app.py, then modifying the code in chatreadretrieveread.py to query multiple indexes across search clients in different places (user selects which index to use here again; user oblivious to the underlying complexity). Unsure if anyone has tried this before.

EOSG-DataDrive avatar Dec 21 '23 01:12 EOSG-DataDrive

Hi @EOSG-DataDrive , did you solve this challenge of querying two indices (or search services)?

jhchein avatar Feb 28 '24 15:02 jhchein

@EOSG-DataDrive, I am curious about this as well

mattzimmers-esker avatar Mar 27 '24 13:03 mattzimmers-esker