public static string GetAllTypes(string index) { var c = Commands.GetMapping(index, "_all"); var connection = Elastic_Utils.ElsaticConnection(); return(connection.Get(c).Result); }
public static void Delete_Entry(string index_name, string type, string id) { var command = Commands.Delete(index_name, type, id); var connection = Elastic_Utils.ElsaticConnection(); bool type_exists = Elastic_Utils.IfIndexOrTypeExists(index_name + "/" + type, connection); if (type_exists) { connection.Delete(command); } }
public static IEnumerable <T> GetDataForPatientID <T>(string index, string type, string patient_id) { var connection = Elastic_Utils.ElsaticConnection(); var serializer = new JsonNetSerializer(); var command = Commands.Search(index, type); var query = BuildGetDataForPatientIdQuery <T>(patient_id); var result = connection.Post(command, query); var data = serializer.ToSearchResult <T>(result).Documents; return(data); }
public static void Delete_Item(string index_name, string type, object id) { try { var command = Commands.Delete(index_name, type, id.ToString()); var connection = Elastic_Utils.ElsaticConnection(); connection.Delete(command); connection.Post(index_name + "/_refresh"); } catch { } }
public static void ExplicitDelete(string index, string type, IEnumerable <string> ids) { var connection = Elastic_Utils.ElsaticConnection(); foreach (var id in ids) { try { var command = Commands.Delete(index, type, id); connection.Delete(command); } catch { } } connection.Post(index + "/_refresh"); }
public static void DeleteDataForPatientID <T>(string index, string type, string patient_id, IEnumerable <string> types = null) where T : IElasticMapper { var searchCommand = Commands.Search(index, type); var serializer = new JsonNetSerializer(); var connection = Elastic_Utils.ElsaticConnection(); var query = BuildGetDataForPatientIdQuery <T>(patient_id, false, types); var result = connection.Post(searchCommand, query); var data = serializer.ToSearchResult <T>(result).Documents; if (data.Any()) { ExplicitDelete(index, type, data.Select(t => t.id)); } connection.Post(index + "/_refresh"); }
public static void DeleteDataForField <T>(string index, string type, string field, string value) where T : IElasticMapper { var searchCommand = Commands.Search(index, type); var serializer = new JsonNetSerializer(); var connection = Elastic_Utils.ElsaticConnection(); var query = BuildGetDataForFieldQuery <T>(field, value); var result = connection.Post(searchCommand, query); var data = serializer.ToSearchResult <T>(result).Documents; if (data.Any()) { ExplicitDelete(index, type, data.Select(t => t.id)); } connection.Post(index + "/_refresh"); }