这是排序的es语句
{
"from": 0,
"size": 10,
"query": {
"bool": {
"must": [
{
"match": {
"databaseCode.comma": {
"query": "article_news",
"operator": "OR",
"prefix_length": 0,
"max_expansions": 50,
"fuzzy_transpositions": true,
"lenient": false,
"zero_terms_query": "NONE",
"auto_generate_synonyms_phrase_query": true,
"boost": 1
}
}
},
{
"bool": {
"adjust_pure_negative": true,
"boost": 1
}
}
],
"adjust_pure_negative": true,
"boost": 1
}
},
"_source": {
"includes": [],
"excludes": [
"@timestamp",
"@version",
"CreateDate",
"ExportDate"
]
},
"sort": [
{
"标题.keyword": {
"order": "desc"
}
}
],
"highlight": {
"pre_tags": [
"<span style='color:red'>"
],
"post_tags": [
"</span>"
],
"fields": {
"databaseCode": {},
"databaseCode.comma": {}
}
}
}
这是返回结果
第一页
第二页
???????????????????????????????????????????
文本类型,尤其是首字为汉字的,这是什么蜜汁排序?
???????????????????????????????????????????
这个mapping
{
"article_all": {
"mappings": {
"article_all": {
"properties": {
"@timestamp": {
"type": "date"
},
"@version": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"CreateDate": {
"type": "date"
},
"ExportDate": {
"type": "date"
},
"YEAR": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"abstrat": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"suggest": {
"type": "completion",
"analyzer": "pinyin_prefix_analyzer",
"search_analyzer": "keyword",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
},
"analyzer": "pinyin_analyzer",
"search_analyzer": "ik_max_word"
},
"area": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"suggest": {
"type": "completion",
"analyzer": "pinyin_prefix_analyzer",
"search_analyzer": "keyword",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
},
"analyzer": "pinyin_analyzer",
"search_analyzer": "ik_max_word"
},
"author": {
"type": "text",
"fields": {
"comma": {
"type": "text",
"analyzer": "comma_analyzer",
"fielddata": true
},
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"suggest": {
"type": "completion",
"analyzer": "pinyin_prefix_analyzer",
"search_analyzer": "keyword",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
},
"analyzer": "pinyin_analyzer",
"search_analyzer": "ik_max_word"
},
"category_id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"content": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"suggest": {
"type": "completion",
"analyzer": "pinyin_prefix_analyzer",
"search_analyzer": "keyword",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
},
"analyzer": "pinyin_analyzer",
"search_analyzer": "ik_max_word"
},
"databaseCode": {
"type": "text",
"fields": {
"comma": {
"type": "text",
"analyzer": "comma_analyzer",
"fielddata": true
},
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"suggest": {
"type": "completion",
"analyzer": "pinyin_prefix_analyzer",
"search_analyzer": "keyword",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
},
"analyzer": "pinyin_analyzer",
"search_analyzer": "ik_max_word"
},
"datafrom": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"suggest": {
"type": "completion",
"analyzer": "pinyin_prefix_analyzer",
"search_analyzer": "keyword",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
},
"analyzer": "pinyin_analyzer",
"search_analyzer": "ik_max_word"
},
"datasysid": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"suggest": {
"type": "completion",
"analyzer": "pinyin_prefix_analyzer",
"search_analyzer": "keyword",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
},
"analyzer": "pinyin_analyzer",
"search_analyzer": "ik_max_word"
},
"file_path": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"suggest": {
"type": "completion",
"analyzer": "pinyin_prefix_analyzer",
"search_analyzer": "keyword",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
},
"analyzer": "pinyin_analyzer",
"search_analyzer": "ik_max_word"
},
"format": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"suggest": {
"type": "completion",
"analyzer": "pinyin_prefix_analyzer",
"search_analyzer": "keyword",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
},
"analyzer": "pinyin_analyzer",
"search_analyzer": "ik_max_word"
},
"id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"suggest": {
"type": "completion",
"analyzer": "pinyin_prefix_analyzer",
"search_analyzer": "keyword",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
},
"analyzer": "pinyin_analyzer",
"search_analyzer": "ik_max_word"
},
"is_lock": {
"type": "integer"
},
"key_word": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"suggest": {
"type": "completion",
"analyzer": "pinyin_prefix_analyzer",
"search_analyzer": "keyword",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
},
"analyzer": "pinyin_analyzer",
"search_analyzer": "ik_max_word"
},
"month": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"suggest": {
"type": "completion",
"analyzer": "pinyin_prefix_analyzer",
"search_analyzer": "keyword",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
},
"analyzer": "pinyin_analyzer",
"search_analyzer": "ik_max_word"
},
"publish_time": {
"type": "date"
},
"sort_id": {
"type": "integer"
},
"source_database": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"suggest": {
"type": "completion",
"analyzer": "pinyin_prefix_analyzer",
"search_analyzer": "keyword",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
},
"analyzer": "pinyin_analyzer",
"search_analyzer": "ik_max_word"
},
"source_id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"suggest": {
"type": "completion",
"analyzer": "pinyin_prefix_analyzer",
"search_analyzer": "keyword",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
},
"analyzer": "pinyin_analyzer",
"search_analyzer": "ik_max_word"
},
"sys_fld_browserate": {
"type": "integer"
},
"sys_fld_downloadrate": {
"type": "integer"
},
"title": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"suggest": {
"type": "completion",
"analyzer": "pinyin_prefix_analyzer",
"search_analyzer": "keyword",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
},
"analyzer": "pinyin_analyzer",
"search_analyzer": "ik_max_word"
},
"type": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"unit": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"suggest": {
"type": "completion",
"analyzer": "pinyin_prefix_analyzer",
"search_analyzer": "keyword",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
},
"analyzer": "pinyin_analyzer",
"search_analyzer": "ik_max_word"
},
"year": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"suggest": {
"type": "completion",
"analyzer": "pinyin_prefix_analyzer",
"search_analyzer": "keyword",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
}
},
"analyzer": "pinyin_analyzer",
"search_analyzer": "ik_max_word"
}
}
}
}
}
}
按照字符串的ASCII进行排序
你用es做搜索,查出来的结果肯定都是相关的,他有一个算法,会根据相关性打分,打分高的,排最前面
如果一样呢
不知道你能不能看的进去。。。
有个社区分享大神一直在写相关的东西,你可以看下这个文章。
https://blog.csdn.net/UbuntuTouch/article/details/104132454?