1

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);
            }
        }
mahesh_ing
  • 419
  • 1
  • 3
  • 10
  • What is the underlying type of the objects in the records array? – Bruce Johnston Aug 05 '17 at 15:57
  • @BruceJohnston it is a class definition for the myindex.json file that defines the iindex ARM creation – mahesh_ing Aug 05 '17 at 16:29
  • Is it mandatory to decorate this class with SerializePropertyNamesAsCamelCase which is missing in my case? Does that make any difference? – mahesh_ing Aug 05 '17 at 16:31
  • That depends on whether the properties in your model class match the case of your index fields. Since you have a model class, why not pass an array of that type rather than object[]? – Bruce Johnston Aug 06 '17 at 07:26
  • UpsertRecords is a generic function used to merge and upload in other indexes too. For simplicity, I showed only one index above code snippet. But I will give shot by separating that. I actually get the List of type and was casting it to array of object. – mahesh_ing Aug 06 '17 at 14:00
  • What version of the Microsoft.Azure.Search NuGet package are you using? – Bruce Johnston Aug 07 '17 at 19:02
  • Did you figure this out? I want to try to repro this, but I need to know what version of the SDK you're using. – Bruce Johnston Aug 10 '17 at 19:12

0 Answers0