NEST analyze与mapping

        /// 
        /// POST /_analyze?pretty=true
        /// POST /employee/_analyze 
        /// 
        public void Analyze()
        {
            client.Analyze(x => x.Analyzer("standard").Text("Text to analyze").Pretty());
            client.Analyze(x=>x.Index("employee").Field("last_name").Text("陈一狮"));
        }

        /// 
        /// GET /employee/_mapping/employee?pretty=true
        /// 
        public void GetMapping()
        {
            client.GetMapping(x => x.Pretty());
        }

        /// 
        /// PUT /employee/employee/_mapping
        /// 
        public void Mapping()
        {
            var response = client.IndexExists("employee");
            if(!response.Exists)
            {
                client.CreateIndex("employee");
            }
            client.Map(m => m.Properties(p => p.Text(t => t.Name("age").Index(false))).AutoMap());
        }

  

你可能感兴趣的:(NEST analyze与mapping)