/// <summary>
        /// 检测索引是否已经存在
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public bool IsIndexExsit(string index)
        {
            bool           flag   = false;
            StringResponse resStr = null;

            try
            {
                resStr = client.IndicesExists <StringResponse>(index);
                if (resStr.HttpStatusCode == 200)
                {
                    flag = true;
                }
            }
            catch (Exception ex)
            {
                if (resStr != null)
                {
                    LogUtil.LogInfo(logger, resStr.DebugInformation, nodeId);
                }
                LogUtil.LogError(logger, ex.ToString(), nodeId);
            }

            return(flag);
        }
Exemple #2
0
 //Check if in index exists
 public bool indexExists(String index)
 {
     return(client.IndicesExists <StringResponse>(index).HttpStatusCode == 200);
 }