/// <summary>
        /// Dynamic = false无法搜索
        /// </summary>
        public void Dynamicmapping()
        {
            var response = client.IndexExists("employee");
            if (!response.Exists)
            {
                client.CreateIndex("employee");
            }
            client.Map<employee>(m => m.Dynamic(false).Properties(p => p.Text(t => t.Name("last_name").Fielddata().Analyzer("english").Fields(f => f.Keyword(k => k.Name("raw"))))).AutoMap());
        }

        public void CustomDynamictemplate()
        {
            client.Map<employee>(m => m.DynamicTemplates(d => d.DynamicTemplate("es", dy => dy.Match("*_es").MatchMappingType("string").Mapping(ma => ma.Text(te => te.Analyzer("spanish"))))));

        }

        /// <summary>
        /// 别名
        /// </summary>
        public void Alias()
        {
            client.Alias(x=>x.Add(a=>a.Index("employee").Alias("em")));
        }

  

posted on 2019-09-24 16:23  chester·chen  阅读(320)  评论(0编辑  收藏  举报