ElasticSearch学习笔记

1.搜索所有结果,并按照balance倒序排序,返回条数设置为最大1000条

1 {
2   "size": 1000,
3   "sort": {
4     "balance": {
5       "order": "desc"
6     }
7   }
8 }

结果:

2.模糊匹配关键字keyword,搜索address中含有"Court"字符串的记录 

1 {
2   "size": 1000,
3   "query": {
4     "match": {
5       "address": "Court"
6     }
7   }
8 }

结果:

 

3.完整匹配,需要用到“匹配短语”,match_phrase

查询语句为:

1 {
2   "size": 1000,
3   "query": {
4     "match_phrase": {
5       "address": "Tabor Court"
6     }
7   }
8 }

结果:

 

未完待续...

posted @ 2016-09-02 10:52  浩月白雪  阅读(1186)  评论(0编辑  收藏  举报