protected JObject OnExecute(ElasticsearchClientOperation client, ElasticsearchSearch query) { var response = client.Execute(query); if (!response.Success) { throw new Exception(response.Body); } var root = JObject.Parse(response.Body); return(root); }
protected DataSet OnExecuteDataSet(ElasticsearchClientOperation client, ElasticsearchSearch query) { var root = OnExecute(client, query); var parser = Parsers.FirstOrDefault(x => x.CanHandle(root)) ?? throw new ArgumentException(); var ds = new DataSet(); var dt = parser.Execute(root); ds.Tables.Add(dt); dt.AcceptChanges(); return(ds); }
public StringResponse Execute(ElasticsearchSearch query) { if (string.IsNullOrEmpty(query.Index)) { return(lowLevelClient.Search <StringResponse>(query.Query)); } else if (string.IsNullOrEmpty(query.Type)) { return(lowLevelClient.Search <StringResponse>(query.Index, query.Query)); } else { return(lowLevelClient.Search <StringResponse>(query.Index, query.Type, query.Query)); } }
public object OnExecuteScalar(ElasticsearchClientOperation client, ElasticsearchSearch query) { throw new NotImplementedException(); }
public List <T> OnExecuteList <T>(ElasticsearchClientOperation client, ElasticsearchSearch query) { throw new NotImplementedException(); }