标签:local 排序 rom arch mat date 完整 通配符 ati
1 分页:
localhost:9200/get-together/_search
{
"query": {
"match_all": {}
},
"from": 10,
"size": 10
}
2 查询具体字段:
localhost:9200/get-together/_search
{
"query": {
"match_all": {}
},
"_source": ["name", "date"]
}
在指定字段时,你甚至可以使用通配符,比如你要查询name和nation,只要写na*就行了;你也可以指定你不想要返回的字段 "exclude": ["location.geolocation"],想要返回的字段:"include": ["location.*", "date"]。
3 排序:
如果没有指定任何排序的信息,es默认按照_score降序排序,score其实就是每个文档与你查询的匹配度。
自定义排序 :localhost:9200/get-together/_search
{
"query": {
"match_all": {}
},
"sort": [
{"created_on": "asc"},
{"name": "desc"},
"_score"
]
}
4 同时运用以上三个的完整查询:localhost:9200/get-together/group/_search
{
"query": {
"match_all": {}
},
"from": 0,
"size": 10,
"_source": ["name", "organizer", "description"],
"sort": [{"created_on": "desc"}]
}
标签:local 排序 rom arch mat date 完整 通配符 ati
原文地址:http://www.cnblogs.com/minjay/p/6724086.html