我试图用标题对结果进行排序,但它无法正常工作。
查询:
GET /products/_search
{
"sort": [
{ "title.keyword": { "order": "desc" }}
],
"query": {
....
},
}
映射
"mappings" : {
"properties" : {
...
"title" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
...
}
}
结果
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 826,
"relation" : "eq"
},
"max_score" : null,
"hits" : [
{
"_index" : "products",
"_type" : "_doc",
"_id" : "1457580605505",
"_score" : null,
"_source" : {
"id" : 1457580605505,
"title" : "Étui-portefeuille multifonction pour iPhone", <-----
"body_html" : "description here",
谷歌搜索后,我找不到适合我的案件的答案。也许是因为我使用的是ES7和解决方案与之不兼容。
我有多个产品以z ...
开头谢谢
é在字符排序中是在z之后。(É与e不同(。当您想在Elastic中排序一些字符串时,应将标准式应用于您的字段以实现自然分类。
您应该转到此文档页面:normorizer
在您的情况下,由于您使用了法语,因此您的标准器应由小写和ascii_folding过滤器组成。因此,文档页面中的示例应完全符合您的需求。