嵌套和弹性搜索-使用LINQ lambda更新映射以收集属性吗?

时间:2018-12-11 17:36:20

标签: linq elasticsearch lambda collections nest

我的内部用户可以随时将新值添加到属性列表中。因此,我需要每天使用新属性更新索引映射。

我可以使用Kibana使用一个新属性更新它:

PUT indexname/_mapping/catalogitem/
{
        "properties": {
          "Attributes": {
            "properties": {
                "Type de Drum & Perc. Acc.": {
                  "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              }
            }
          }
        }
      }

但是拥有List<string> Attributes,如何在NEST中使用LINQ lambda更新索引映射? 我没有运气就尝试了以下方法:

var updateResponce = nestClient.UpdateAsync(indexName, c => c.Mappings(ms => ms.Properties(p => p.Attributes(pr => pr.Properties.AutoMap()(ps => ps.ForEach(currentAttributes))))));

0 个答案:

没有答案