コード例 #1
0
		public OperateResult ModifyIndex(string index, IndexSetting indexSetting)
		{
			Contract.Assert(!string.IsNullOrEmpty(index));
			Contract.Assert(indexSetting != null);

			string url = "/" + index.ToLower() + "/_settings";

			string json = "{{\"number_of_replicas\" : {0}}}".Fill(indexSetting.NumberOfReplicas);

			RestResponse result = _provider.Put(url, json);
			return GetOperationResult(result);
		}
コード例 #2
0
		public OperateResult CreateIndex(string index, IndexSetting indexSetting)
		{
			Contract.Assert(!string.IsNullOrEmpty(index));
			Contract.Assert(indexSetting != null);

			string url = "/" + index.ToLower() + "/";

			string json = JsonSerializer.Get(indexSetting);
			json = "{    index : " + json + " }";

			RestResponse result = _provider.Post(url, json);
			return GetOperationResult(result);
		}