当我这样排序时:
.Sort(sortDescriptor => sortDescriptor.Descending(product => product.TopProduct))
我没有点击 . 知道为什么吗?语法错误还是什么?我是从官方NEST / elasticsearch docs网站获得的 .
SOLUTION
我不得不像这样添加 .Suffix("keyword")
:
.Sort(sortDescriptor => sortDescriptor.Descending(product => product.TopProduct.Suffix("keyword")))
它奏效了 . 我不得不在“TopProduct”上使用“keyword”子字段 .
String propertiesedit的默认映射:使用自动映射时,字符串POCO类型的推断映射是包含关键字子字段的多字段的文本数据类型
如果索引没有映射的字符串,则5.0中的ES现在会自动创建该字段的文本版本和关键字版本(在.keyword下) . - dakroneLee HinmanElastic团队成员
资料来源:https://discuss.elastic.co/t/is-sorting-on-text-string-field-no-longer-available-in-5-x/68586/4
这有效但有人可以向我解释文本和关键字数据类型的工作原理吗?