ElasticSearch实战(三十)-排序查询
Posted 张志翔ۤ
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ElasticSearch实战(三十)-排序查询相关的知识,希望对你有一定的参考价值。
我们之前学过几种查询方式了,但是结果顺序都是elasticsearch决定的。我们来给查询结果搞上我们定制的顺序。
1、准备数据
DELETE company-001-sort
PUT company-001-sort/_doc/1
{
"name":"顾老二",
"age":30,
"from": "gu",
"desc": "皮肤黑、武器长、性格直",
"tags": ["黑", "长", "直"]
}
PUT company-001-sort/_doc/2
{
"name":"大娘子",
"age":18,
"from":"sheng",
"desc":"肤白貌美,娇憨可爱",
"tags":["白", "富","美"]
}
PUT company-001-sort/_doc/3
{
"name":"龙套偏房",
"age":22,
"from":"gu",
"desc":"mmp,没怎么看,不知道怎么形容",
"tags":["造数据", "真","难"]
}
PUT company-001-sort/_doc/4
{
"name":"石头",
"age":29,
"from":"gu",
"desc":"粗中有细,狐假虎威",
"tags"
以上是关于ElasticSearch实战(三十)-排序查询的主要内容,如果未能解决你的问题,请参考以下文章