2
votes

We need to update a batch of documents based on some criteria in an Azure Search Index. The only way we can think of with the current implementation is :

  1. Search for the required documents (e.g. Category = 1)

  2. Create new documents using the document Id of the result

  3. In the new documents update the required fields (e.g. Price = Price*1.1)

  4. Use a Merge to Update the newly created documents to update existing ones.

The above code looks like we are back in the 1960s or that we have a few screws loose in our brain! Is this the only way to achieve this in Azure Search?

We are using the .NET SDK.

1

1 Answers

4
votes

Your algorithm to update documents matching a query is indeed correct. One note: use filter instead of full-text search - it will be more efficient.

Azure Search is a search engine, not a general-purpose database, so it doesn't directly support an equivalent of SQL's UPDATE ... WHERE pattern.