Andy N
Andy N

Reputation: 1304

Azure Search .Net SDK: Dictionary to fields

My application allows Azure Cognitive Search text fields to be added after runtime.

Is there any way to populating these fields using the .Net ACS SKD?

E.g.

public class DynamicDocument {
  [SimpleField(IsKey = true)]
  public string id {get; set;}
  
  // How to unnest these?
  public Dictionary<string,string> attributes {get; set;}
}

...or is the only option to skip the SDK and make the HTTP calls directly (potentially using something like JsonExtensionData to serialise the dictionary)?

Upvotes: 0

Views: 75

Answers (1)

Andy N
Andy N

Reputation: 1304

Looks like you can use SearchDocument to both read and write generic results from ACS. Therefore it's just a matter of mapping your POCOs to instances of SearchDocument.

Upvotes: 1

Related Questions