我正在使用嵌套5.0的弹性搜索
我需要将ignore_above从默认值256增加到512。
我可以通过属性映射来完成吗?
否则,如何使用流畅的API执行此操作?
答案 0 :(得分:1)
您可以使用[Keyword(IgnoreAbove=512)]
更改值:
[ElasticsearchType(Name = "mytype")]
class mytype
{
// default: will be mapped to both keyword (keyword search)
// and text (full-text search)
public string defaultString { get; set; }
// by default ignore above is set to 256
[Keyword]
public string keywordType { get; set; }
// change ignore above
[Keyword(IgnoreAbove=512)]
public string longKeyword { get; set; }
// text type, full-text search
[Text]
public string textType { get; set; }
// store but not searched
[Text(Index = false)]
public string textTypeNotSearchable { get; set; }
}
这是ElasticSearch中为上述类型创建的索引:
"defaultString": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"keywordType": {
"type": "keyword"
},
"longKeyword": {
"type": "keyword",
"ignore_above": 512
},
"textType": {
"type": "text"
},
"textTypeNotSearchable": {
"type": "text",
"index": false
}