private JsonObject ParseJson(JsonObject jo, bool parseJson) { if (jo != null && !jo.IsEmpty) { if (parseJson) { foreach (var jp in jo.Properties()) { switch (jp.Name) { case "query": Query = jp.Value.Get <JsonObject>().ToQuery(); break; case "size": Size = jp.Value.Get <int>(); break; case "from": From = jp.Value.Get <int>(); break; case "sort": Sort = GetSort(jp); break; case "_source": Source = new SearchSource(jp.Value); break; case "search_after": SearchAfter = jp.Value.Get <JsonArray>().Select(e => e.Get()).ToArray(); break; } } } else { return(jo); } } return(null); }
public SearchRequest HideSource() { Source = new SearchSource(null, null); return(this); }
public SearchRequest SetSource(string[] includes, string[] excludes = null) { Source = new SearchSource(includes, excludes); return(this); }