public void Update(IndexConfiguration conf) { if (conf == null) throw new ArgumentNullException("conf"); Dictionary<string, Object> data = conf.ToConfigurationMap(); if (data.Count == 0) throw new ArgumentNullException("conf"); if (!Exists()) throw new IndexDoesNotExistException("Index does not exist"); try { CallApi<Dictionary<string, Object>>(PUT_METHOD, indexUrl, null, data, PrivatePass); } catch (HttpCodeException e) { if (e.GetHttpCode() == 204) { RefreshMetadata(); return; } throw new UnexpectedCodeException(e); } }
public Index CreateIndex(string indexName, IndexConfiguration conf) { Index index = GetIndex(indexName); index.Create(conf); return index; }
public void Create(IndexConfiguration conf) { if (Exists()) throw new IndexAlreadyExistsException("Index already exists"); Dictionary<string, Object> data = null; if (conf != null) data = conf.ToConfigurationMap(); try { CallApi<Dictionary<string, Object>>(PUT_METHOD, indexUrl, null, data, PrivatePass); } catch (HttpCodeException e) { switch (e.GetHttpCode()) { case 204: throw new IndexAlreadyExistsException(e); case 409: throw new MaximumIndexesExceededException(e); default: throw new UnexpectedCodeException(e); } } }