elasticsearch NEST client, filed with attribute “not_analyzed” still be analyzed when search keywords contains hyphen

梦想与她 提交于 2019-12-05 21:16:51

I had the same problem, the solution is first create the index then put the mapping and at last add your data.

Add Type Attribute to your model field

 [ElasticProperty(OmitNorms = true, Index = FieldIndexOption.NotAnalyzed)]

        var node = new Uri("http://192.168.0.56:9200/");
        var settings = new ConnectionSettings(node, defaultIndex: "ticket");
        var client = new ElasticClient(settings);

        var createIndexResult = client.CreateIndex("ticket");
        var mapResult = client.Map<TicketElastic>(c => c.MapFromAttributes().IgnoreConflicts().Type("TicketElastic").Indices("ticket"));
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!