public IndicesResponse DeleteMapping <T>(string index, string type) where T : class { var path = this.CreatePath(index, type); var status = this.Connection.DeleteSync(path); var response = new IndicesResponse(); try { response = JsonConvert.DeserializeObject <IndicesResponse>(status.Result); } catch { } response.ConnectionStatus = status; return(response); }
/// <summary> /// Deletes a mapping. /// </summary> /// <typeparam name="T">Mapped type.</typeparam> /// <returns>Response status information.</returns> public IndicesResponse DeleteMapping <T>() where T : class { var type = this.InferTypeName <T>(); var path = this.createPath(this.Settings.DefaultIndex, type); var status = this.Connection.DeleteSync(path); var response = new IndicesResponse(); try { response = JsonConvert.DeserializeObject <IndicesResponse>(status.Result); } catch { } response.ConnectionStatus = status; return(response); }
public IndicesResponse CreateIndex(string index, IndexSettings settings) { string path = this.CreatePath(index); string data = JsonConvert.SerializeObject(settings, Formatting.None, this.SerializationSettings); var status = this.Connection.PostSync(path, data); var response = new IndicesResponse(); response.ConnectionStatus = status; try { response = JsonConvert.DeserializeObject <IndicesResponse>(status.Result); response.IsValid = true; } catch (Exception e) { } return(response); }
public IndicesResponse ClearCache(List <string> indices, ClearCacheOptions options) { string path = "/_cache/clear"; if (indices != null && indices.Any(s => !string.IsNullOrEmpty(s))) { path = "/" + string.Join(",", indices.Where(s => !string.IsNullOrEmpty(s)).ToArray()) + path; } if (options != ClearCacheOptions.All) { var caches = new List <string>(); if ((options & ClearCacheOptions.Id) == ClearCacheOptions.Id) { caches.Add("id=true"); } if ((options & ClearCacheOptions.Filter) == ClearCacheOptions.Filter) { caches.Add("filter=true"); } if ((options & ClearCacheOptions.FieldData) == ClearCacheOptions.FieldData) { caches.Add("field_data=true"); } if ((options & ClearCacheOptions.Bloom) == ClearCacheOptions.Bloom) { caches.Add("bloom=true"); } path += "?" + string.Join("&", caches.ToArray()); } ConnectionStatus status = this.Connection.PostSync(path, string.Empty); var response = new IndicesResponse(); try { response = JsonConvert.DeserializeObject <IndicesResponse>(status.Result); response.IsValid = true; } catch { } response.ConnectionStatus = status; return(response); }
public IndicesResponse Map <T>(string index, string type) where T : class { string path = this.CreatePath(index, type) + "_mapping"; string map = this.CreateMapFor <T>(type); ConnectionStatus status = this.Connection.PutSync(path, map); var response = new IndicesResponse(); try { response = JsonConvert.DeserializeObject <IndicesResponse>(status.Result); response.IsValid = true; } catch { } response.ConnectionStatus = status; return(response); }