using Newtonsoft.Json.Linq;
public static dynamic AddTermToMatchQuery(JObject match, string fieldName, string fieldValue)
match.Add(new JProperty(fieldName, fieldValue));
public static void Main()
dynamic query = new JObject();
query.match = new JObject();
query.match = AddTermToMatchQuery(query.match, "fieldName1", "fieldValue1");
Console.WriteLine(query.ToString());
query.match = AddTermToMatchQuery(query.match, "fieldName2", "fieldValue2");
Console.WriteLine(query.ToString());