2015-08-13 36 views
1

截至目前,我正在使用NEST将数据索引到Elasticsearch中。 当我试图领域的指标一个是not_analyzed使用下面的代码:如何添加一个not_analyzed字段到Elasticsearch中

var settings = new ConnectionSettings(
       node, 
       defaultIndex: "resourceid5_analyzed1" 
      ) 
      .SetDefaultPropertyNameInferrer(p => p); 

      var client = new ElasticClient(settings); 
      var response = client.Map<GoodDataAttribute>(m => m.MapFromAttributes() 
       .Properties(props => props 
       .String(s1 => s1 
       .Name(p => p.ResourceGroup) 
       .Analyzer("keyword") 
       .IncludeInAll(false) 
       .Index(FieldIndexOption.NotAnalyzed) 
       .OmitNorms(true)))); 

我已经使用SetDefaultPropertyNameInferrer禁用的弹性性质 的骆驼情况下,我提前

使用NEST版本1.7 谢谢

回答

0

如果您尝试更新现有映射,那么您不能将现有字段从“已分析”更改为“未分析”。

做到这一点,你需要删除索引

https://www.elastic.co/guide/en/elasticsearch/guide/current/mapping-intro.html#updating-a-mapping

+0

截至目前指数还没有被创建。 var settings = new ConnectionSettings( node, defaultIndex:“resourceid5_analyzed1” ) .SetDefaultPropertyNameInferrer(p => p); 此处default-index已创建索引。 即使那么字段是not_analyzed。 – AkankshaGupta

相关问题