Search code examples
azureazure-cognitive-search

What to do when entities keeps changing in Azure Search?


I'm working on a chat-like application and would like to provide search capability for it. I was thinking of using Azure search. Once possibility is to consider each chat room as a single entity in the Azure search so that each entity represents a single chat room. The challenge I encounter is because each chat room keeps receiving new messages, the index for a chat room keeps changing. I can use a queue mechanism to queue up the changes and update my entities in the Azure Search but I don't know whether it is a good and scalable solution. Obviously I need to increase the number of replicas to keep up with the changes. Any recommendation? Is Azure search a suitable tool for such a scenario?


Solution

  • H.Z.,

    We do have customers that use us for Chat / Instant Message based applications, so we might be viable for your needs. Before I answer your questions, can you tell me what types of things you would want to be able to search?

    Is it merely to search the chat rooms or is it to search both chat rooms as well as the messages within these chat rooms? If it is just to search the chat rooms, you might want to consider going your suggested approach and then store the chat messages in a lower cost store (such as Azure Storage) and then simply pull in the message text as needed.

    If it is the latter, then the next question would be whether you want to be able to do a search that spans both chat rooms and the messages within them which would indicate that it makes a lot of sense to have them within a single index, although whether you put all messages in a single document or have one document per message we should drill into a bit more. The main issue I would think of with having all messages in one index is in the case where a user wants to drill into (or filter) specific messages within a chat room. I am thinking this might be a little harder then if you split messages into separate documents.

    Another option might be to have 2 indexes. One that has the chat rooms and then another that has the individual messages within them.

    In any case, I hope that helps as a start and based on your responses hopefully I can help you drill into the details more.

    Liam