IndexBatch.MergeOrUpload is not updating Azure Search Index but Indexer is

时间:2017-08-05 12:17:06

标签: azure indexing azure-search azure-search-.net-sdk

The Azure Search service has 4 indexes and out of that 3 indexes are configured to Azure SQL View data source with high water mark change tracking policy. The Indexer runs every 30 mins.

There are some scenarios where we need to Merge & Upload some documents directly to Index. We first update the DB and then to Index through Azure Search .Net SDK. We are passing Array of Object to MergeOrUpload. My problem is that if I pass 1 record the index gets updated correctly and I can see the updated search result. But when I try to MergeOrUpload multiple records the index is not getting updated but after next scheduled indexer run they get indexed successfully. Note that I get Success after the MergeOrUpload but cannot see the updated/inserted records.

Here is the call we use from Azure Search .net SDK -

public async Task<DocumentIndexResult> UpsertRecords(string index, object[] records)
        {
         if (index.Equals("MyIndexName",StringComparison.CurrentCultureIgnoreCase))  
            {
            var batch = IndexBatch.MergeOrUpload(records);
            return await custDataIndex.Documents.IndexAsync(batch);
            }
        }

0 个答案:

没有答案