1

So i'm trying to update record in search index via api which works fine when i provide the index key, e.g.

{  
  "value": [  
    {  
      "@search.action": "merge",  
      "hotelid": "4618416",     
      "HotelName":"Gacc Capital"      
    }
  ]  
} 

However due to nature and structure of the index getting created from different databases hence the primary key of the index is not present in all databases.

See below example where field "ContactName" is stored in different database,

  "value": [
        {
            "@search.score": 1,
            "HotelId": "124",
            "HotelName": "Gacc Capital",
            "Description": "Chic hotel near the city.  High-rise hotel in downtown, walking distance to theaters, restaurants and shops, complete with wellness programs."              
            "Category": "Paid",
            "Amount": "£123456",
            "ContactId": "456",
            "ContactName":"Mr David Koh",
      ]  
    } 

The issue i'm having to update particular field whenever there's a change, for instance if someone changes their name from "Mr David Koh" to "Mr David Warner Koh" i need a way to update all the record where contactid is 456

Is there a way to tackle this problem? or am i missing piece of puzzle before hand!

Not sure if this possibile in azure search sdk (c#) but happy to give it ago if this works better than API.

CodeBox
  • 13
  • 5

1 Answers1

0

I assume you have two different types of records with relations. It’s not clear from your question.

To keep relational data updated you could do the data maintenance in an actual database that has a view that resembles what your index looks like. Then index that view.

Alternatively, you could implement the logic yourself. Just query for all record ids that contains a contact with a specific ID and then update each of those records like you did above.

Dan Gøran Lunde
  • 5,148
  • 3
  • 26
  • 24