索引操作
mapping映射属性
- type: 字段数据类型,
- 字符串: text(可分词的文本),keyword(精确值,不可以分词的文本)如下图,邮箱就是keyword, 名字就是tex
- 数值: long,integer, short,byte,double,float
- 布尔: boolean
- 日期:date
- index: 是否创建倒排索引, 默认是true
- analyzer: 使用哪种分词器
- properties: 该字段使用的子字段
索引库CRUD
创建索引库名
- dsl语法如下
- 创建索引库语法如下
PUT /heima
{
"mappings": {
"properties": {
"info": {
"type": "text",
"analyzer": "ik_smart"
},
"email": {
"type": "keyword",
"index": false
},
"name" :{
"type": "object",
"properties": {
"firstName": {
"type": "keyword"
},
"lastName": {
"type": "keyword"
}
}
}
}
}
}
- 然后生成了下面的结果
删除和查看索引
- 查看
GET /heima
- 删除
DELETE /heima
修改索引库
- 在es中禁止修改修改索引库,但是我们可以添加新的字段
PUT /index_name/_mapping
{
"properties": {
"new_index":{
"type": "integer"
}
}
}
- 示例
// 添加实例
PUT /heima/_mapping
{
"properties": {
"age":{
"type": "integer"
}
}
}
GET /heima
- 发现增添了 age
文档操作
文档的CRUD
添加文档
// 插入文档
POST /heima/_doc/1
{
"info": "梅子留酸软齿牙,芭蕉分绿与窗纱。日长睡起无情思,闲看儿童捉柳花",
"email": "114514@qq.com",
"name": {
"firstname": "杨",
"lastname": "万里"
}
}
查询文档
GET /heima/_doc/1
- 结果
{
"_index" : "heima",
"_type" : "_doc",
"_id" : "1",
"_version" : 1,
"_seq_no" : 0,
"_primary_term" : 1,
"found" : true,
"_source" : {
"info" : "梅子留酸软齿牙,芭蕉分绿与窗纱。日长睡起无情思,闲看儿童捉柳花",
"email" : "114514@qq.com",
"name" : {
"firstname" : "杨",
"lastname" : "万里"
}
}
}
删除文档
DELETE /heima/_doc/1
修改文档
全量修改
- 几乎和索引相似, 他还会添加新文档, 删除旧的文档
- 如果没有的文档,他会直接创建
- 原本有什么字段, 就得写出来什么字段, 不能少写,不能多写
// 插入文档
POST /heima/_doc/1
{
"info": "梅子留酸软齿牙,芭蕉分绿与窗纱。日长睡起无情思,闲看儿童捉柳花1111",
"email": "11451455555555@qq.com",
"name": {
"firstname": "杨1",
"lastname": "万里1"
}
}
增量修改
- 注意这里是POST ,而不是PUT
POST /heima/_update/1
{
"doc": {
"email": "12312314@qq.com"
}
}
DSL查询文档
DSL查询分类
Elasticsearch提供了基于JSON的DSL(Domain Specific Language)来定义查询。常见的查询类型包括:
- 查询所有:查询出所有数据,一般测试用。例如:match_all
- 全文检索(full text)查询:利用分词器对用户输入内容分词,然后去倒排索引库中匹配。例如:
- match_query
- multi_match_query
- 精确查询:根据精确词条值查找数据,一般是查找keyword、数值、日期、boolean等类型字段。例如:
- ids
- range
- term
- 地理(geo)查询:根据经纬度查询。例如:
- geo_distance
- geo_bounding_box
- 复合(compound)查询:复合查询可以将上述各种查询条件组合起来,合并查询条件。例如:
- bool
- function_score
查询的语法基本一致:
GET /indexName/_search
{
"query": {
"查询类型": {
"查询条件": "条件值"
}
}
}
我们以查询所有为例,其中:
- 查询类型为match_all
- 没有查询条件
// 查询所有
GET /indexName/_search
{
"query": {
"match_all": {
}
}
}
其它查询无非就是查询类型、查询条件的变化。
全文检索查询
准备索引
PUT /hotel
{
"mappings": {
"properties": {
"id": {
"type": "keyword"
},
"name": {
"type": "text",
"analyzer": "ik_max_word",
"copy_to": "all"
},
"address": {
"type": "keyword",
"index": false
},
"price": {
"type": "integer"
},
"socre": {
"type": "integer"
},
"brand": {
"type": "keyword",
"copy_to": "all"
},
"city": {
"type": "keyword"
},
"starName": {
"type": "keyword"
},
"business": {
"type": "keyword",
"copy_to": "all"
},
"location": {
"type": "geo_point"
},
"pic": {
"type": "keyword",
"index": false
},
"all": {
"type": "text",
"analyzer": "ik_max_word"
}
}
}
}
插入文档
{"address":"静安交通路40号","brand":"7天酒店","business":"四川北路商业区","city":"上海","id":36934,"location":"31.251433, 121.47522","name":"7天连锁酒店(上海宝山路地铁站店)","pic":"https://m.tuniucdn.com/fb2/t1/G1/M00/3E/40/Cii9EVkyLrKIXo1vAAHgrxo_pUcAALcKQLD688AAeDH564_w200_h200_c1_t0.jpg","price":336,"score":37,"starName":"二钻"}
{"address":"广灵二路126号","brand":"速8","business":"四川北路商业区","city":"上海","id":38609,"location":"31.282444, 121.479385","name":"速8酒店(上海赤峰路店)","pic":"https://m.tuniucdn.com/fb2/t1/G2/M00/DF/96/Cii-TFkx0ImIQZeiAAITil0LM7cAALCYwKXHQ4AAhOi377_w200_h200_c1_t0.jpg","price":249,"score":35,"starName":"二钻"}
{"address":"兰田路38号","brand":"速8","business":"长风公园地区","city":"上海","id":38665,"location":"31.244288, 121.422419","name":"速8酒店上海中山北路兰田路店","pic":"https://m.tuniucdn.com/fb2/t1/G2/M00/EF/86/Cii-Tlk2mV2IMZ-_AAEucgG3dx4AALaawEjiycAAS6K083_w200_h200_c1_t0.jpg","price":226,"score":35,"starName":"二钻"}
{"address":"徐汇龙华西路315弄58号","brand":"7天酒店","business":"八万人体育场地区","city":"上海","id":38812,"location":"31.174377, 121.442875","name":"7天连锁酒店(上海漕溪路地铁站店)","pic":"https://m.tuniucdn.com/fb2/t1/G2/M00/E0/0E/Cii-TlkyIr2IEWNoAAHQYv7i5CkAALD-QP2iJwAAdB6245_w200_h200_c1_t0.jpg","price":298,"score":37,"starName":"二钻"}
{"address":"闵行莘庄镇七莘路299号","brand":"7天酒店","business":"莘庄工业区","city":"上海","id":39106,"location":"31.113812, 121.375869","name":"7天连锁酒店(上海莘庄地铁站店)","pic":"https://m.tuniucdn.com/fb2/t1/G2/M00/D8/11/Cii-T1ku2zGIGR7uAAF1NYY9clwAAKxZAHO8HgAAXVN368_w200_h200_c1_t0.jpg","price":348,"score":41,"starName":"二钻"}
{"address":"杨浦国权路315号","brand":"7天酒店","business":"江湾、五角场商业区","city":"上海","id":39141,"location":"31.290057, 121.508804","name":"7天连锁酒店(上海五角场复旦同济大学店)","pic":"https://m.tuniucdn.com/fb2/t1/G2/M00/C7/E3/Cii-T1knFXCIJzNYAAFB8-uFNAEAAKYkQPcw1IAAUIL012_w200_h200_c1_t0.jpg","price":349,"score":38,"starName":"二钻"}
{"address":"虹桥路100号","brand":"万怡","business":"徐家汇地区","city":"上海","id":45845,"location":"31.192714, 121.434717","name":"上海西藏大厦万怡酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/48GNb9GZpJDCejVAcQHYWwYyU8T_w200_h200_c1_t0.jpg","price":589,"score":45,"starName":"四钻"}
{"address":"新元南路555号","brand":"豪生","business":"滴水湖临港地区","city":"上海","id":45870,"location":"30.871729, 121.81959","name":"上海临港豪生大酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2F5HoQvBgypoDUE46752ppnQaTqs_w200_h200_c1_t0.jpg","price":896,"score":45,"starName":"四星级"}
{"address":"恒丰路338号","brand":"万怡","business":"上海火车站地区","city":"上海","id":46829,"location":"31.242977, 121.455864","name":"上海浦西万怡酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/x87VCoyaR8cTuYFZmKHe8VC6Wk1_w200_h200_c1_t0.jpg","price":726,"score":46,"starName":"四钻"}
{"address":"施新路958号","brand":"华美达","business":"浦东机场核心区","city":"上海","id":47066,"location":"31.147989, 121.759199","name":"上海浦东东站华美达酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2pNujAVaQbXACzkHp8bQMm6zqwhp_w200_h200_c1_t0.jpg","price":408,"score":46,"starName":"四钻"}
{"address":"松江荣乐东路677号","brand":"速8","business":"佘山、松江大学城","city":"上海","id":47478,"location":"31.016712, 121.261606","name":"速8酒店(上海松江中心店)","pic":"https://m.tuniucdn.com/filebroker/cdn/res/07/36/073662e1718fccefb7130a9da44ddf5c_w200_h200_c1_t0.jpg","price":428,"score":35,"starName":"二钻"}
{"address":"东方路838号","brand":"万怡","business":"浦东陆家嘴金融贸易区","city":"上海","id":56201,"location":"31.226031, 121.525801","name":"上海齐鲁万怡大酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/52/B6/Cii-TF3eXKeIJeN7AASiKHbTtx4AAGRegDSBzMABKJA111_w200_h200_c1_t0.jpg","price":873,"score":44,"starName":"四星级"}
{"address":"新金桥路18号","brand":"华美达","business":"浦东金桥地区","city":"上海","id":56214,"location":"31.244916, 121.590752","name":"上海浦东华美达大酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3jtXiuMKZEXJAuKuAkc47yLCjUBt_w200_h200_c1_t0.jpg","price":830,"score":45,"starName":"四星级"}
{"address":"南桥镇南桥路1号","brand":"万怡","business":"奉贤开发区","city":"上海","id":56227,"location":"30.910917, 121.456525","name":"上海圣淘沙万怡酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/52/B9/Cii-U13eXSiIdJjXAARSA6FywFYAAGRnwHvy1AABFIb158_w200_h200_c1_t0.jpg","price":899,"score":45,"starName":"四星级"}
{"address":"番禺路400号","brand":"皇冠假日","business":"徐家汇地区","city":"上海","id":56392,"location":"31.202768, 121.429524","name":"上海银星皇冠假日酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/37ucQ38K3UFdcRqntJ8M5dt884HR_w200_h200_c1_t0.jpg","price":809,"score":47,"starName":"五星级"}
{"address":"武东路188号","brand":"豪生","business":"江湾/五角场商业区","city":"上海","id":56852,"location":"31.304182, 121.492936","name":"上海财大豪生大酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2jGHezLZvPZqC9cBGesbP5vAhCXi_w200_h200_c1_t0.jpg","price":592,"score":46,"starName":"五钻"}
{"address":"月华路9号","brand":"华美达","business":"奉贤开发区","city":"上海","id":56912,"location":"30.814382, 121.464521","name":"上海华凯华美达广场酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/45iaCNCuZavJTxwTLskhVKzwynLD_w200_h200_c1_t0.jpg","price":747,"score":40,"starName":"四钻"}
{"address":"黄兴路1888号","brand":"华美达","business":"江湾/五角场商业区","city":"上海","id":56977,"location":"31.292932, 121.519759","name":"上海五角场华美达大酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/26VREqAQdaGFvJdAJALVtjxcNMpL_w200_h200_c1_t0.jpg","price":499,"score":40,"starName":"三钻"}
{"address":"世纪大道88号(54楼办理入住)","brand":"君悦","business":"浦东陆家嘴金融贸易区","city":"上海","id":60214,"location":"31.235152, 121.506082","name":"上海金茂君悦大酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/7Azm3jvGUHuXe3eS1DrixAWVTXY_w200_h200_c1_t0.jpg","price":699,"score":46,"starName":"五星级"}
{"address":"静安华山路250号","brand":"希尔顿","business":"静安寺地区","city":"上海","id":60223,"location":"31.219306, 121.445427","name":"上海希尔顿酒店","pic":"https://m.tuniucdn.com/filebroker/cdn/res/92/10/9210e74442aceceaf6e196d61fc3b6b1_w200_h200_c1_t0.jpg","price":2688,"score":37,"starName":"五星级"}
{"address":"杨高北路1000号","brand":"皇冠假日","business":"浦东外高桥地区","city":"上海","id":60359,"location":"31.338944, 121.590611","name":"上海外高桥皇冠假日酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/VcKUM9zUSiVgDhFioc6mWQoX9ES_w200_h200_c1_t0.jpg","price":3299,"score":46,"starName":"五星级"}
{"address":"南京西路88号","brand":"丽笙","business":"人民广场地区","city":"上海","id":60363,"location":"31.23462, 121.47327","name":"上海新世界丽笙大酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2j31b7X3YzGkf4Li3phS6TG1mtwm_w200_h200_c1_t0.jpg","price":1341,"score":46,"starName":"五星级"}
{"address":"邯郸路199号","brand":"皇冠假日","business":"江湾/五角场商业区","city":"上海","id":60398,"location":"31.295382, 121.502537","name":"上海复旦皇冠假日酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2H1Gk8LHaBWZfYvR6NYYcGTvACmL_w200_h200_c1_t0.jpg","price":924,"score":47,"starName":"五星级"}
{"address":"黄浦路199号","brand":"君悦","business":"外滩地区","city":"上海","id":60487,"location":"31.245409, 121.492969","name":"上海外滩茂悦大酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2Swp2h1fdj9zCUKsk63BQvVgKLTo_w200_h200_c1_t0.jpg","price":689,"score":44,"starName":"五星级"}
{"address":"汾阳路1号","brand":"豪生","business":"淮海路/新天地地区","city":"上海","id":60522,"location":"31.215497, 121.456297","name":"上海嘉豪淮海国际豪生酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/38UBi4QYuaF8jN94CxQ7tb7tjtmZ_w200_h200_c1_t0.jpg","price":425,"score":45,"starName":"四钻"}
{"address":"沪宜公路3101号","brand":"万怡","business":"嘉定新城","city":"上海","id":60916,"location":"31.368523, 121.258567","name":"上海绿地万怡酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3VLwG9tTQQnp3M3MTeMTdx9nas9B_w200_h200_c1_t0.jpg","price":328,"score":45,"starName":"四钻"}
{"address":"红松东路1116号","brand":"希尔顿","business":"虹桥地区","city":"上海","id":60922,"location":"31.18746, 121.395312","name":"上海虹桥祥源希尔顿酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/tQRqDTFkHnHzMZiDKjcGV81ekvc_w200_h200_c1_t0.jpg","price":1108,"score":45,"starName":"五钻"}
{"address":"四平路59号","brand":"喜来登","business":"四川北路商业区","city":"上海","id":60935,"location":"31.2579, 121.487954","name":"上海虹口三至喜来登酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3C3gxLxLjVwnkxJwJm8rd3f38kcd_w200_h200_c1_t0.jpg","price":1899,"score":46,"starName":"五星级"}
{"address":"西藏中路555号","brand":"万豪","business":"人民广场地区","city":"上海","id":61075,"location":"31.236681, 121.473529","name":"上海雅居乐万豪酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3FoT16PkXavKsssvktVvVq5Si6Cr_w200_h200_c1_t0.jpg","price":1152,"score":46,"starName":"五钻"}
{"address":"自由贸易试验区临港新片区南岛1号","brand":"皇冠假日","business":"滴水湖临港地区","city":"上海","id":61083,"location":"30.890867, 121.937241","name":"上海滴水湖皇冠假日酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/312e971Rnj9qFyR3pPv4bTtpj1hX_w200_h200_c1_t0.jpg","price":971,"score":44,"starName":"五钻"}
{"address":"王府井东街8号","brand":"希尔顿","business":"天安门/王府井地区","city":"北京","id":309208,"location":"39.914539, 116.413392","name":"北京王府井希尔顿酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/52/10/Cii-TF3ePt2IX9UEAALb6VYBSmoAAGKMgGsuW8AAtwB147_w200_h200_c1_t0.jpg","price":1679,"score":46,"starName":"五钻"}
{"address":"长安街1号东方广场","brand":"君悦","business":"天安门/王府井地区","city":"北京","id":394559,"location":"39.909635, 116.414621","name":"北京东方君悦大酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3mFqcNSh7eEo9yc3Rw2P5HDNTdDe_w200_h200_c1_t0.jpg","price":686,"score":45,"starName":"五星级"}
{"address":"建国门内大街甲18号","brand":"豪生","business":"北京站/建国门地区","city":"北京","id":394617,"location":"39.905768, 116.428153","name":"北京宝辰饭店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/NEYa6EfDHuhhb19Ct85WBbkKHZU_w200_h200_c1_t0.jpg","price":418,"score":44,"starName":"四星级"}
{"address":"东北三环西坝河太阳宫桥东北角云南大厦","brand":"皇冠假日","business":"国展中心地区","city":"北京","id":394796,"location":"39.972409, 116.434698","name":"北京新云南皇冠假日酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/dfP8K782eTsohQWSRdkd7St9LA2_w200_h200_c1_t0.jpg","price":485,"score":46,"starName":"五星级"}
{"address":"东三环北路东方路1号","brand":"希尔顿","business":"燕莎/朝阳公园商业区","city":"北京","id":395434,"location":"39.952703, 116.462387","name":"北京希尔顿酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3fwNbKGhk6XCrkdVyxwhC5uGpLVy_w200_h200_c1_t0.jpg","price":350,"score":45,"starName":"五星级"}
{"address":"首都机场3号航站楼三经路1号","brand":"希尔顿","business":"首都机场/新国展地区","city":"北京","id":395702,"location":"40.048969, 116.619566","name":"北京首都机场希尔顿酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/52/10/Cii-U13ePtuIMRSjAAFZ58NGQrMAAGKMgADZ1QAAVn_167_w200_h200_c1_t0.jpg","price":222,"score":46,"starName":"五钻"}
{"address":"霄云路甲26号","brand":"万豪","business":"燕莎/朝阳公园商业区","city":"北京","id":395787,"location":"39.959861, 116.467363","name":"北京海航大厦万豪酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3zFiWi2C9SmbcQwCZgJFQC9ahvs5_w200_h200_c1_t0.jpg","price":1302,"score":46,"starName":"五钻"}
{"address":"王府井大街48号","brand":"皇冠假日","business":"天安门/王府井地区","city":"北京","id":395799,"location":"39.918994, 116.411277","name":"北京国际艺苑皇冠假日酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/52/10/Cii-U13ePvyIahjPAAMykV278aEAAGKOQO9e4UAAzKp283_w200_h200_c1_t0.jpg","price":636,"score":44,"starName":"五星级"}
{"address":"天竺镇府前一街13号","brand":"华美达","business":"首都机场/新国展地区","city":"北京","id":395815,"location":"40.062832, 116.580678","name":"北京明豪华美达酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/52/13/Cii-U13eP2mIKCwvAAODTZXT-fAAAGKVAA9taIAA4Nl245_w200_h200_c1_t0.jpg","price":558,"score":46,"starName":"四钻"}
{"address":"三丰北里3号","brand":"皇冠假日","business":"三里屯/工体/东直门地区","city":"北京","id":396189,"location":"39.92129, 116.43847","name":"北京朝阳悠唐皇冠假日酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/tT6ipLain1ZovR5gnQ7tJ4KKym5_w200_h200_c1_t0.jpg","price":944,"score":46,"starName":"五钻"}
{"address":"海淀北太平庄花园路甲17号","brand":"维也纳","business":"马甸、安贞地区","city":"北京","id":396471,"location":"39.970837, 116.365244","name":"维也纳酒店(北京花园路店)","pic":"https://m.tuniucdn.com/filebroker/cdn/res/17/00/1700926908bae6ba3e5ef96de7b7d4cc_w200_h200_c1_t0.jpg","price":381,"score":36,"starName":"三钻"}
{"address":"北三环东路36号","brand":"喜来登","business":"马甸/安贞地区","city":"北京","id":396506,"location":"39.967163, 116.4099","name":"北京金隅喜来登酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/29FW2WtGzzUtPhWR1LKxcFZAVa9P_w200_h200_c1_t0.jpg","price":357,"score":47,"starName":"五星级"}
{"address":"东城天坛东里甲48号","brand":"7天酒店","business":"前门、崇文门商贸区","city":"北京","id":413460,"location":"39.875786, 116.421987","name":"7天连锁酒店(北京天坛店)","pic":"https://m.tuniucdn.com/fb2/t1/G2/M00/C7/D8/Cii-T1knCK6IWTtxAAI0plLButMAAKYTAJu-woAAjS-422_w200_h200_c1_t0.jpg","price":753,"score":38,"starName":"二钻"}
{"address":"丰台马家堡西路22号","brand":"7天酒店","business":"永定门、南站、大红门、南苑地区","city":"北京","id":413476,"location":"39.845363, 116.372327","name":"7天连锁酒店(北京南站店)","pic":"https://m.tuniucdn.com/fb2/t1/G1/M00/26/B7/Cii-U1knCtaISM4VAAHkEQd-mrAAAKw0ALVCwEAAeQp741_w200_h200_c1_t0.jpg","price":478,"score":37,"starName":"二钻"}
{"address":"西城平安里西大街翠花街育幼胡同甲20-22号","brand":"7天酒店","business":"西单、金融街地区","city":"北京","id":414168,"location":"39.931338, 116.364982","name":"7天连锁酒店(北京西直门店)","pic":"https://m2.tuniucdn.com/filebroker/cdn/res/bc/66/bc666859edf4fc072a8006c66758058d_w200_h200_c1_t0.jpg","price":419,"score":37,"starName":"二钻"}
{"address":"朝阳团结湖北里9号楼","brand":"7天酒店","business":"燕莎、三里屯商业区","city":"北京","id":414481,"location":"39.928457, 116.466132","name":"7天连锁酒店(北京团结湖地铁站店)","pic":"https://m.tuniucdn.com/fb2/t1/G1/M00/38/2D/Cii9EFkv2-uIPTaBAALX6P-rbdUAALPpwHv4ykAAtgA277_w200_h200_c1_t0.jpg","price":525,"score":36,"starName":"二钻"}
{"address":"朝阳北京市朝阳区酒仙桥北路(798艺术区北门)彩虹路6号-电通创意广场大院内","brand":"7天酒店","business":"望京、酒仙桥、798地区","city":"北京","id":414698,"location":"39.990671, 116.498452","name":"7天连锁酒店(北京798艺术区店)","pic":"https://m.tuniucdn.com/fb2/t1/G2/M00/D8/11/Cii-T1ku2zqIN7SiAAEdvT6RrjUAAKxZQKFooYAAR3V090_w200_h200_c1_t0.jpg","price":553,"score":37,"starName":"二钻"}
{"address":"三间房乡褡裢坡村青年沟西侧558号","brand":"如家","business":"传媒大学/管庄地区","city":"北京","id":415600,"location":"39.923212, 116.560023","name":"如家酒店(北京朝阳北路传媒大学褡裢坡地铁站店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3NezpxNZWQMdNXibwbMkQuAZjDyJ_w200_h200_c1_t0.jpg","price":259,"score":47,"starName":"二钻"}
{"address":"海淀北洼路甲3号","brand":"7天酒店","business":"西直门及北京展览馆地区","city":"北京","id":415659,"location":"39.936138, 116.302405","name":"7天连锁酒店(北京紫竹桥店)","pic":"https://m.tuniucdn.com/fb2/t1/G1/M00/3C/22/Cii9EVkxPMqIZJz-AAIh0esETAIAALXbgNQkH8AAiHp053_w200_h200_c1_t0.jpg","price":781,"score":42,"starName":"二钻"}
{"address":"莲花池东路120-2号6层","brand":"如家","business":"北京西站/丽泽商务区","city":"北京","id":416121,"location":"39.896449, 116.317382","name":"如家酒店(北京西客站北广场店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/42DTRnKbiYoiGFVzrV9ZJUxNbvRo_w200_h200_c1_t0.jpg","price":275,"score":43,"starName":"二钻"}
{"address":"永顺镇西马庄小区","brand":"7天酒店","business":"果园环岛、通州区","city":"北京","id":416260,"location":"39.915443, 116.631871","name":"7天连锁酒店(北京通州八里桥店)","pic":"https://m.tuniucdn.com/fb2/t1/G2/M00/DF/5A/Cii-TlkxkeGIKM0oAAGOb64RvToAALBAAH9Fg8AAY6H201_w200_h200_c1_t0.jpg","price":534,"score":38,"starName":"二钻"}
{"address":"朝阳路高井176号","brand":"和颐","business":"国贸地区","city":"北京","id":416268,"location":"39.918277, 116.53015","name":"和颐酒店(北京传媒大学财满街店)","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/52/13/Cii-TF3eP5GIJIOLAAUwsIVCxdAAAGKXgK5a0IABTDI239_w200_h200_c1_t0.jpg","price":524,"score":46,"starName":"三钻"}
{"address":"后沙峪镇裕民大街32号","brand":"速8","business":"首都机场/新国展地区","city":"北京","id":416307,"location":"40.099019, 116.543655","name":"速8酒店(北京新国展首都机场后沙峪店)","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/52/3E/Cii-TF3eRgGIHCkKAAP_ATvriiQAAGL0AIoLtUAA_8Z513_w200_h200_c1_t0.jpg","price":350,"score":39,"starName":"二钻"}
{"address":"唐山路145号","brand":"7天酒店","business":"北外滩地区","city":"上海","id":432335,"location":"31.252585, 121.498753","name":"7天连锁酒店(上海北外滩国际客运中心地铁站店)","pic":"https://m2.tuniucdn.com/filebroker/cdn/res/c1/ba/c1baf64418437c56617f89840c6411ef_w200_h200_c1_t0.jpg","price":249,"score":35,"starName":"二钻"}
{"address":"南京东路480号保安坊内","brand":"如家","business":"人民广场地区","city":"上海","id":433576,"location":"31.236454, 121.480948","name":"如家酒店(上海南京路步行街店)","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/52/BA/Cii-U13eXVaIQmdaAAWxgzdXXxEAAGRrgNIOkoABbGb143_w200_h200_c1_t0.jpg","price":379,"score":44,"starName":"二钻"}
{"address":"复兴东路260号","brand":"如家","business":"豫园地区","city":"上海","id":434082,"location":"31.220706, 121.498769","name":"如家酒店·neo(上海外滩城隍庙小南门地铁站店)","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/52/B6/Cii-U13eXLGIdHFzAAIG-5cEwDEAAGRfQNNIV0AAgcT627_w200_h200_c1_t0.jpg","price":392,"score":44,"starName":"二钻"}
{"address":"西坝河东里36号","brand":"如家","business":"国展中心地区","city":"北京","id":441836,"location":"39.966238, 116.450142","name":"如家酒店(北京国展三元桥店)","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/52/39/Cii-TF3eRTGITp1UAAYIilRD7skAAGLngIuAnQABgii479_w200_h200_c1_t0.png","price":458,"score":47,"starName":"二钻"}
{"address":"吴泾镇宝秀路977号","brand":"如家","business":"交大/闵行经济开发区","city":"上海","id":485775,"location":"31.047135, 121.46224","name":"如家酒店(上海闵行华东师范大学吴泾店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/V8pz15CkiMX5xYJRmbbp5zkKWJ8_w200_h200_c1_t0.jpg","price":161,"score":45,"starName":"二钻"}
{"address":"文化北街4-16号","brand":"7天酒店","business":"平谷城区","city":"北京","id":489756,"location":"40.14308, 117.111554","name":"7天连锁酒店(北京平谷店)","pic":"https://m2.tuniucdn.com/filebroker/cdn/res/2e/b4/2eb4edb22ddb981307d8570beb1d746d_w200_h200_c1_t0.jpg","price":544,"score":40,"starName":"二钻"}
{"address":"布吉路1036号","brand":"如家","business":"田贝/水贝珠宝城","city":"深圳","id":517915,"location":"22.583191, 114.118499","name":"如家酒店·neo(深圳草埔地铁站店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/228vhBCQmFRFWQBYX1cgoFQb6x58_w200_h200_c1_t0.jpg","price":159,"score":44,"starName":"二钻"}
{"address":"福华一路28号","brand":"皇冠假日","business":"会展中心/CBD","city":"深圳","id":527938,"location":"22.537153, 114.053529","name":"深圳好日子皇冠假日酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/b6Ztz5jn4MngK3Hzfxuu9JGsjrm_w200_h200_c1_t0.jpg","price":590,"score":46,"starName":"五星级"}
{"address":"莘庄镇莘浜路172号","brand":"如家","business":"莘庄工业区","city":"上海","id":541619,"location":"31.105797, 121.37755","name":"如家酒店(上海莘庄地铁站龙之梦商业广场店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3mKs3jETvJDj3dDdkRB9UyLLvPna_w200_h200_c1_t0.jpg","price":149,"score":44,"starName":"二钻"}
{"address":"沪南路938号","brand":"华美达","business":"浦东新国际博览中心","city":"上海","id":542068,"location":"31.182761, 121.554106","name":"上海茂业华美达广场酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2139uDFUZ2VKxrathwSeeE4DwyFU_w200_h200_c1_t0.jpg","price":646,"score":40,"starName":"三钻"}
{"address":"嘉宾路2002号(毗邻金光华购物广场)","brand":"万丽","business":"罗湖口岸/火车站","city":"深圳","id":546869,"location":"22.540989, 114.122665","name":"深圳彭年万丽酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/gwAbqEXFUpjUBmnxUfK89p3zBBT_w200_h200_c1_t0.jpg","price":701,"score":46,"starName":"五钻"}
{"address":"丰台丰管路8号","brand":"维也纳","business":"北京西站、丽泽商务区","city":"北京","id":581859,"location":"39.857707, 116.312482","name":"维也纳酒店(北京丰益桥店)(原申晨酒店)","pic":"https://m2.tuniucdn.com/filebroker/cdn/res/97/43/97438481b9e79abad429e5c30d7f303f_w200_h200_c1_t0.jpg","price":648,"score":45,"starName":"三钻"}
{"address":"华强南路3024号赛格苑1栋","brand":"7天酒店","business":"华强北商业区","city":"深圳","id":584697,"location":"22.539831, 114.087899","name":"7天连锁酒店(深圳华强赛格广场店)","pic":"https://m.tuniucdn.com/fb2/t1/G2/M00/D8/11/Cii-T1ku2zmIcP4sAAEw8iuLXFgAAKxZQH7HVYAATEK972_w200_h200_c1_t0.jpg","price":362,"score":36,"starName":"二钻"}
{"address":"海淀厢红旗路功德寺桥北侧","brand":"7天酒店","business":"香山、八大处风景区","city":"北京","id":593228,"location":"40.003959, 116.256718","name":"7天连锁酒店(北京颐和园店)","pic":"https://m2.tuniucdn.com/filebroker/cdn/res/55/84/55841f502c5a711e66dd5454b64f559b_w200_h200_c1_t0.jpg","price":730,"score":38,"starName":"二钻"}
{"address":"金新路99号","brand":"豪生","business":"浦东金桥地区","city":"上海","id":598591,"location":"31.252496, 121.600085","name":"上海丽昂豪生大酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2KfPPyPx9rWyVXif2CUuxv61Nryc_w200_h200_c1_t0.jpg","price":529,"score":47,"starName":"四钻"}
{"address":"滨河大道6033号海滨广场国皇大厦3楼","brand":"汉庭","business":"皇岗口岸/福田口岸","city":"深圳","id":607915,"location":"22.528101, 114.064221","name":"汉庭酒店(深圳皇岗店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/qMyCJVYuW21nsCeEBt8CMfmEhra_w200_h200_c1_t0.jpg","price":313,"score":42,"starName":"二钻"}
{"address":"东川公路5863号","brand":"如家","business":"浦东机场核心区","city":"上海","id":608374,"location":"31.237662, 121.718556","name":"如家酒店(上海浦东机场龙东大道合庆店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/LUYxGGV4pzjKeN5a69K4deU8JD8_w200_h200_c1_t0.jpg","price":160,"score":45,"starName":"二钻"}
{"address":"花山路1209号","brand":"如家","business":"浦东外高桥地区","city":"上海","id":609023,"location":"31.351148, 121.585606","name":"如家酒店·neo(上海外高桥保税区北地铁站店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3cJ6KTfms9cfEnME8WRkQQBXBkYm_w200_h200_c1_t0.jpg","price":266,"score":45,"starName":"二钻"}
{"address":"民治街道梅龙路与民旺路交汇处","brand":"华美达","business":"深圳北站地区","city":"深圳","id":609372,"location":"22.620501, 114.033874","name":"豪派特华美达广场酒店(深圳北站店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3G5TnUCPbjGYHAVWfvuixw8bs69t_w200_h200_c1_t0.jpg","price":498,"score":45,"starName":"四钻"}
{"address":"宝安南路1881号","brand":"君悦","business":"万象城/京基100","city":"深圳","id":624417,"location":"22.537247, 114.111182","name":"深圳君悦酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/45/EA/Cii-TF3ZpVmIVDJ9AAXvJftz_AgAAFrrQKbI4oABe89086_w200_h200_c1_t0.jpg","price":442,"score":47,"starName":"五钻"}
{"address":"人民南路2011号","brand":"如家","business":"罗湖口岸/火车站","city":"深圳","id":628327,"location":"22.536734, 114.118336","name":"如家酒店·neo(深圳罗湖口岸国贸地铁站店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2rKHmQWHYiY8GZA3xBHpFKCLZwZo_w200_h200_c1_t0.png","price":223,"score":45,"starName":"二钻"}
{"address":"十八里店乡周家庄288号","brand":"和颐","business":"劲松/潘家园地区","city":"北京","id":629023,"location":"39.853354, 116.483437","name":"和颐酒店(北京十里河欢乐谷店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/28hnDdqn5uzuzCKYkw2x4pYmunXM_w200_h200_c1_t0.jpg","price":390,"score":47,"starName":"四钻"}
{"address":"浦东新区蔡伦路103号","brand":"7天酒店","business":"浦东张江地区","city":"上海","id":629729,"location":"31.196154, 121.62071","name":"7天连锁酒店(上海张江高科园区店)","pic":"https://m2.tuniucdn.com/filebroker/cdn/res/d9/61/d961508a10865b9b29c033064f31b913_w200_h200_c1_t0.jpg","price":267,"score":36,"starName":"二钻"}
{"address":"龙岗中心城龙翔大道9009号珠江广场","brand":"皇冠假日","business":"龙岗中心区/大运新城","city":"深圳","id":635963,"location":"22.722941, 114.250002","name":"深圳龙岗珠江皇冠假日酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/45/EA/Cii-U13ZpWGIasKjAAY1SNE36KMAAFrrwMNoAwABjVg973_w200_h200_c1_t0.jpg","price":737,"score":46,"starName":"五星级"}
{"address":"福华路一号大中华国际交易广场","brand":"喜来登","business":"会展中心/CBD","city":"深圳","id":636080,"location":"22.535567, 114.062005","name":"深圳大中华喜来登酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3hQRTmAUW9PegTjxMiEfYwh2HnKp_w200_h200_c1_t0.jpg","price":1556,"score":47,"starName":"五星级"}
{"address":"自由贸易试验区基隆路28号(二号门内)","brand":"喜来登","business":"浦东外高桥地区","city":"上海","id":644417,"location":"31.350989, 121.588751","name":"上海外高桥喜来登酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/1Rrtg9n7PdMEivVDhsehbJBrEre_w200_h200_c1_t0.jpg","price":2419,"score":46,"starName":"五钻"}
{"address":"新金桥路15号","brand":"万豪","business":"浦东金桥地区","city":"上海","id":648219,"location":"31.244061, 121.591153","name":"上海金桥红枫万豪酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/52/B6/Cii-TF3eXKuIR_a0AAUx-Xd2JLQAAGRfACSpvUABTIR560_w200_h200_c1_t0.jpg","price":891,"score":47,"starName":"五钻"}
{"address":"新桥街道万丰社区中心路7-1号","brand":"华美达","business":"深圳国际会展中心商圈","city":"深圳","id":657192,"location":"22.716473, 113.826391","name":"深圳宝安中天美景华美达酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/45/EA/Cii-U13ZpVeIRbhTAAOzGZSDtlcAAFrrQEWM-AAA7Mx626_w200_h200_c1_t0.jpg","price":498,"score":45,"starName":"四钻"}
{"address":"龙华新区龙华龙观西路95号","brand":"维也纳","business":"深圳北站地区","city":"深圳","id":659496,"location":"22.65892, 114.006817","name":"维也纳酒店(深圳国王店)","pic":"https://m2.tuniucdn.com/filebroker/cdn/res/b4/76/b476cacc575a7ff237128ba2fd63923a_w200_h200_c1_t0.jpg","price":714,"score":37,"starName":"三钻"}
{"address":"昌平路319号","brand":"华美达","business":"回龙观/天通苑地区","city":"北京","id":670673,"location":"40.084219, 116.304313","name":"北京龙城华美达酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/T3WruZV3S4MfcxdD1HFVhZjaBLW_w200_h200_c1_t0.jpg","price":506,"score":45,"starName":"四钻"}
{"address":"酒仙桥北路9号荧屏里4号楼","brand":"和颐","business":"望京/酒仙桥/798地区","city":"北京","id":672207,"location":"39.98835, 116.491217","name":"和颐至尊酒店(北京望京798店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2y56zwK8kd2tBuRUyF7XeJ2ucvWM_w200_h200_c1_t0.jpg","price":579,"score":44,"starName":"四钻"}
{"address":"沿河南路1064号","brand":"和颐","business":"罗湖口岸/火车站","city":"深圳","id":684720,"location":"22.533753, 114.122491","name":"和颐酒店(深圳罗湖口岸火车地铁站店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2LFgB2iFawKKoGADwzhW6jpCSaJT_w200_h200_c1_t0.jpg","price":208,"score":47,"starName":"四钻"}
{"address":"漕宝路509号","brand":"华美达","business":"光大会展中心/漕河泾地区","city":"上海","id":696948,"location":"31.163802, 121.405618","name":"上海新园华美达广场酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/52/B6/Cii-TF3eXHuIE57sAAZx8iP6rMIAAGRbgAH09gABnIK621_w200_h200_c1_t0.jpg","price":1290,"score":45,"starName":"四星级"}
{"address":"丰台莲花池东路126号","brand":"速8","business":"北京西站、丽泽商务区","city":"北京","id":706343,"location":"39.896623, 116.315586","name":"速8酒店(北京西客站北广场店)","pic":"https://m.tuniucdn.com/fb2/t1/G2/M00/E3/46/Cii-TlkzMXWIL0sAAAGG8a3YwiwAALJlgG-r5YAAYcJ067_w200_h200_c1_t0.jpg","price":268,"score":39,"starName":"二钻"}
{"address":"徐汇桂林路46号(钦州南路路口往南100米)","brand":"维也纳","business":"光大会展中心","city":"上海","id":707357,"location":"31.156297, 121.419948","name":"维也纳酒店(上海南站光大店)","pic":"https://m2.tuniucdn.com/filebroker/cdn/res/f7/13/f713f8f98d777d8d53aafefb37a79ef6_w200_h200_c1_t0.jpg","price":3288,"score":36,"starName":"三钻"}
{"address":"朝阳安立路3号1幢3层","brand":"速8","business":"亚运村、奥体中心地区","city":"北京","id":711837,"location":"40.043717, 116.410962","name":"速8酒店(北京立水桥店)","pic":"https://m2.tuniucdn.com/filebroker/cdn/res/b3/87/b3876eaf16af62521cf6fb474504b8ca_w200_h200_c1_t0.jpg","price":268,"score":36,"starName":"二钻"}
{"address":"罗湖区东门中路2216号华佳广场12-14楼(东门天桥东头)","brand":"7天酒店","business":"东门商业区","city":"深圳","id":727679,"location":"22.54585, 114.122227","name":"7天连锁酒店(深圳步行街老街地铁站二店)","pic":"https://m.tuniucdn.com/fb2/t1/G1/M00/39/99/Cii9EFkwVMKIP_mCAAI3fOHlS1wAALSDAMeO2MAAjeU309_w200_h200_c1_t0.jpg","price":742,"score":40,"starName":"二钻"}
{"address":"西乡大道298-7号(富通城二期公交站旁)","brand":"如家","business":"宝安体育中心商圈","city":"深圳","id":728180,"location":"22.569693, 113.860186","name":"如家酒店(深圳宝安西乡地铁站店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/FHdugqgUgYLPMoC4u4rdTbAPrVF_w200_h200_c1_t0.jpg","price":184,"score":43,"starName":"二钻"}
{"address":"晒布路67号","brand":"如家","business":"东门商业区","city":"深圳","id":728415,"location":"22.550183, 114.120771","name":"如家酒店·neo(深圳东门步行街晒布地铁站店)","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/25/57/Cii-U13PFNWISSnQAAEpTtoilsQAAEVWgEvur8AASlm647_w200_h200_c1_t0.jpg","price":152,"score":46,"starName":"二钻"}
{"address":"新洲路世纪工艺品广场307栋","brand":"汉庭","business":"皇岗口岸/福田口岸","city":"深圳","id":728461,"location":"22.518026, 114.046061","name":"汉庭酒店(深圳会展中心店)","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/25/56/Cii-TF3PFKOIPl0JAANm4ge6DdMAAEVTQK2SP8AA2b6365_w200_h200_c1_t0.jpg","price":258,"score":44,"starName":"二钻"}
{"address":"南新路顺富街18号化州大厦","brand":"如家","business":"科技园","city":"深圳","id":728604,"location":"22.525561, 113.920058","name":"如家酒店·neo(深圳南山地铁站南山市场店)","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/25/57/Cii-TF3PFLmIDGWiAAPHkaNTuOIAAEVVQBGazAAA8ep611_w200_h200_c1_t0.jpg","price":198,"score":43,"starName":"二钻"}
{"address":"罗湖区嘉宾路4025号城市天地广场内","brand":"7天酒店","business":"罗湖口岸/火车站","city":"深圳","id":730454,"location":"22.537078, 114.113733","name":"7天连锁酒店(深圳万象城店)","pic":"https://m.tuniucdn.com/fb2/t1/G2/M00/C8/4C/Cii-Tlknhz2IFnYNAAInF2jEK14AAKbcQNB5M8AAicv660_w200_h200_c1_t0.jpg","price":552,"score":43,"starName":"二钻"}
{"address":"孖岭地铁口C出口左手边,青年学院对面","brand":"7天酒店","business":"莲花山/梅林","city":"深圳","id":730569,"location":"22.568701, 114.068464","name":"7天连锁酒店(深圳梅林卓越城店)","pic":"https://m.tuniucdn.com/fb2/t1/G2/M00/D8/0B/Cii-Tlku2dOISeGXAAAUw3MvPrIAAKxYALB2VAAABTb555_w200_h200_c1_t0.jpg","price":269,"score":39,"starName":"二钻"}
{"address":"宝安区宝安25区创业二路步行街金麒麟服装广场4栋","brand":"7天酒店","business":"宝安中心区/前海","city":"深圳","id":730968,"location":"22.568162, 113.900968","name":"7天连锁酒店(深圳宝安地铁站店)","pic":"https://m.tuniucdn.com/fb2/t1/G2/M00/D8/0B/Cii-T1ku2cqIWTOOAAAS_bvRI5UAAKxXwILCFYAABMV285_w200_h200_c1_t0.jpg","price":314,"score":36,"starName":"二钻"}
{"address":"花山路706号","brand":"7天酒店","business":"浦东外高桥地区","city":"上海","id":751035,"location":"31.348029, 121.576896","name":"7天连锁酒店(上海自贸区北门地铁站店)(原外高桥地铁北站店)","pic":"https://m.tuniucdn.com/fb2/t1/G1/M00/3A/21/Cii-U1kwxUCINXaHAAGmh7z6qRAAALUdwMKGREAAaaf928_w200_h200_c1_t0.jpg","price":328,"score":39,"starName":"二钻"}
{"address":"南山区白石洲沙河街2号金三角大厦","brand":"7天酒店","business":"华侨城","city":"深圳","id":844350,"location":"22.540501, 113.968858","name":"7天连锁酒店(深圳世界之窗店)","pic":"https://m.tuniucdn.com/fb2/t1/G2/M00/D8/11/Cii-TFku2zmIOdjCAAAQJpLFhEEAAKxZQIEvQ0AABA-920_w200_h200_c1_t0.jpg","price":769,"score":36,"starName":"二钻"}
{"address":"龙岗街道龙岗墟社区龙平东路62号","brand":"如家","business":"龙岗中心区/大运新城","city":"深圳","id":2316304,"location":"22.730828, 114.278337","name":"如家酒店(深圳双龙地铁站店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/4AzEoQ44awd1D2g95a6XDtJf3dkw_w200_h200_c1_t0.jpg","price":135,"score":45,"starName":"二钻"}
{"address":"福强路新洲九街28号","brand":"维也纳","business":"皇岗口岸/福田口岸","city":"深圳","id":2329005,"location":"22.524835, 114.048214","name":"维也纳酒店(深圳华之沙店)","pic":"https://m2.tuniucdn.com/filebroker/cdn/res/88/f0/88f05cd11990ef39ae187886c76f40a5_w200_h200_c1_t0.jpg","price":651,"score":39,"starName":"三钻"}
{"address":"望海路1177号","brand":"希尔顿","business":"深圳湾口岸/蛇口","city":"深圳","id":2351601,"location":"22.479373, 113.916013","name":"深圳蛇口希尔顿南海酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/45/EA/Cii-TF3ZpXOIfa6fAAJjiUOiuYgAAFrtgDtgpQAAmOh799_w200_h200_c1_t0.jpg","price":509,"score":47,"starName":"五钻"}
{"address":"清河小营安宁庄东路18号20号楼","brand":"如家","business":"上地产业园/西三旗","city":"北京","id":2359697,"location":"40.041322, 116.333316","name":"如家酒店(北京上地安宁庄东路店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2wj2f8mo9WZQCmzm51cwkZ9zvyp8_w200_h200_c1_t0.jpg","price":420,"score":46,"starName":"二钻"}
{"address":"将台路6号","brand":"皇冠假日","business":"望京/酒仙桥/798地区","city":"北京","id":5865979,"location":"39.978133, 116.478642","name":"北京丽都皇冠假日酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/Yo4xL3RUsYUnDDc5QcQWj7sCrUX_w200_h200_c1_t0.jpg","price":1168,"score":47,"starName":"五钻"}
{"address":"广中西路333号","brand":"万豪","business":"大宁国际商业区","city":"上海","id":5870456,"location":"31.279371, 121.446327","name":"上海宝华万豪酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/52/BA/Cii-U13eXVqIZXDFAAUC_xbrQDAAAGRrwPRyOcABQMX057_w200_h200_c1_t0.jpg","price":922,"score":47,"starName":"五钻"}
{"address":"金沙江路1699号","brand":"皇冠假日","business":"长风公园地区","city":"上海","id":5871652,"location":"31.232346, 121.377709","name":"上海圣诺亚皇冠假日酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/J4sP7qRSHa9rFYnKTW75ZPB393M_w200_h200_c1_t0.jpg","price":770,"score":46,"starName":"五钻"}
{"address":"陈家镇揽海路799弄","brand":"凯悦","business":"崇明岛/长兴岛/横沙岛","city":"上海","id":5872067,"location":"31.466563, 121.799671","name":"崇明金茂凯悦酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/fsKrbnNsmSsYnNLmhh3ZvVjZ5cA_w200_h200_c1_t0.jpg","price":1024,"score":46,"starName":"五钻"}
{"address":"闸北芷江西路796号","brand":"速8","business":"上海火车站地区","city":"上海","id":5873072,"location":"31.255579, 121.452903","name":"速8酒店(上海火车站北广场店)","pic":"https://m2.tuniucdn.com/filebroker/cdn/res/96/6d/966d6596e6cb7b48c9cc1d7da79b57c8_w200_h200_c1_t0.jpg","price":190,"score":41,"starName":"二钻"}
{"address":"松岭路9号(南园小学对面)","brand":"汉庭","business":"华强北商业区","city":"深圳","id":7094829,"location":"22.536842, 114.094316","name":"汉庭酒店(深圳华强南店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3WDhaZZ9yALHw8yNiU6HJyrdC3u5_w200_h200_c1_t0.jpg","price":215,"score":40,"starName":"二钻"}
{"address":"清源西路55号","brand":"7天酒店","business":"大兴农业生态观光区","city":"北京","id":189429168,"location":"39.743751, 116.321676","name":"7天连锁酒店(北京大兴黄村清源路地铁站店)","pic":"https://m.tuniucdn.com/fb2/t1/G1/M00/4F/25/Cii9EFk3LmOIFtnDAAHm5kdIiM8AAL1FQM8kG0AAeb-418_w200_h200_c1_t0.jpg","price":392,"score":38,"starName":"二钻"}
{"address":"三间房乡新房村1号","brand":"如家","business":"传媒大学/管庄地区","city":"北京","id":197487869,"location":"39.90635, 116.565528","name":"如家酒店(北京第二外国语大学南门双桥地铁站店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/ZkgDAs8tTMvgFHdVPpikNqENEn1_w200_h200_c1_t0.jpg","price":321,"score":47,"starName":"二钻"}
{"address":"朝阳北苑路18号院3号楼4层","brand":"速8","business":"亚运村、奥体中心地区","city":"北京","id":197488318,"location":"40.043689, 116.414138","name":"速8酒店(北京立水桥地铁南站店)","pic":"https://m.tuniucdn.com/fb2/t1/G1/M00/36/4D/Cii9EVkvP72IYYjgAAF7yZeWV-wAALMQACOARMAAXvh983_w200_h200_c1_t0.jpg","price":344,"score":36,"starName":"二钻"}
{"address":"平谷平谷大街31号","brand":"速8","business":"平谷城区","city":"北京","id":197492277,"location":"40.159255, 117.12401","name":"速8酒店(北京平谷兴谷环岛店)","pic":"https://m.tuniucdn.com/fb2/t1/G1/M00/38/D5/Cii9EFkwFCiII79zAAHKsXy_LAoAALQuQEmEZ4AAcrJ339_w200_h200_c1_t0.jpg","price":614,"score":39,"starName":"二钻"}
{"address":"光明南大街14号","brand":"如家","business":"顺义温泉休闲区","city":"北京","id":197492479,"location":"40.124783, 116.65751","name":"如家酒店(北京顺义中心地铁站店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2hNBSjmMTk6JQ2o8ixr5s3ioevhB_w200_h200_c1_t0.jpg","price":306,"score":45,"starName":"二钻"}
{"address":"团结湖路9号楼","brand":"和颐","business":"燕莎/朝阳公园商业区","city":"北京","id":197496182,"location":"39.930731, 116.466602","name":"和颐酒店(北京团结湖地铁站店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2gK41VpMb4AwyNkwQEkfFo83uTUU_w200_h200_c1_t0.jpg","price":341,"score":44,"starName":"三钻"}
{"address":"昌平北七家镇平西府村(温都水城东200米)","brand":"速8","business":"小汤山温泉度假区","city":"北京","id":197496980,"location":"40.10144, 116.380641","name":"速8酒店(北京温都水城王府店)","pic":"https://m.tuniucdn.com/fb2/t1/G2/M00/C7/CB/Cii-T1km_5eICnpJAAHOWN1GylMAAKYJwF0Hp8AAc5w000_w200_h200_c1_t0.jpg","price":585,"score":39,"starName":"二钻"}
{"address":"丰台南大红门路东营房15号","brand":"速8","business":"永定门、南站、大红门、南苑地区","city":"北京","id":197516492,"location":"39.78996, 116.42081","name":"速8酒店(北京南苑东高地店)","pic":"https://m.tuniucdn.com/fb2/t1/G1/M00/3B/D8/Cii-U1kxKGWIQlaxAAIdkjkSALkAALXDQMFbTsAAh2q158_w200_h200_c1_t0.jpg","price":651,"score":39,"starName":"二钻"}
{"address":"南山区桃园西路160号","brand":"7天酒店","business":"科技园","city":"深圳","id":197835483,"location":"22.532576, 113.916362","name":"7天连锁酒店(深圳大学桃园店)","pic":"https://m.tuniucdn.com/fb2/t1/G1/M00/38/40/Cii9EFkv4XKIQN85AAFUcDrkXe0AALPvwPRn08AAVSI037_w200_h200_c1_t0.jpg","price":431,"score":36,"starName":"二钻"}
{"address":"布吉镇深惠路龙珠商城","brand":"如家","business":"布吉/深圳东站","city":"深圳","id":197837109,"location":"22.602482, 114.123284","name":"如家酒店·neo(深圳龙岗大道布吉地铁站店)","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/25/58/Cii-TF3PFZOIA7jwAAKInGFN4xgAAEVbAGeP4AAAoi0485_w200_h200_c1_t0.jpg","price":127,"score":43,"starName":"二钻"}
{"address":"龙华新区建辉路2号","brand":"汉庭","business":"深圳北站地区","city":"深圳","id":198323591,"location":"22.671313, 114.02784","name":"汉庭酒店(深圳北站龙华汽车站店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2dkB2HzbaBUJ7adZZfZaeS9JCvjP_w200_h200_c1_t0.jpg","price":209,"score":46,"starName":"二钻"}
{"address":"浦建路38号","brand":"喜来登","business":"浦东新国际博览中心","city":"上海","id":200208940,"location":"31.208553, 121.518552","name":"上海浦东喜来登由由公寓","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/m3Nrm37Yx6YV4NwqRvSYnFRNSGk_w200_h200_c1_t0.jpg","price":3168,"score":45,"starName":"五钻"}
{"address":"徐汇钦州北路78号","brand":"7天酒店","business":"光大会展中心","city":"上海","id":200210163,"location":"31.180615, 121.422916","name":"7天连锁酒店(上海徐家汇宜山路地铁站店)","pic":"https://m.tuniucdn.com/fb2/t1/G2/M00/DF/96/Cii-Tlkx0TOIGtOzAAEe_xcDxeIAALCZQJyxf4AAR8X941_w200_h200_c1_t0.jpg","price":219,"score":35,"starName":"二钻"}
{"address":"浦东机场启航路1100号","brand":"华美达","business":"浦东机场核心区","city":"上海","id":200214437,"location":"31.160969, 121.799086","name":"上海浦东机场华美达广场酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2D2gbXDgrMx76uWfwzmoWpmSCCXx_w200_h200_c1_t0.jpg","price":600,"score":45,"starName":"四星级"}
{"address":"江滨路99号(打浦路底)","brand":"万豪","business":"打浦桥地区","city":"上海","id":200214538,"location":"31.192103, 121.47298","name":"上海绿地万豪酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/268jVMuWdYok5ehGFhQ2QNhBhUhs_w200_h200_c1_t0.jpg","price":720,"score":43,"starName":"五星级"}
{"address":"浦建路38号","brand":"喜来登","business":"浦东新国际博览中心","city":"上海","id":200214715,"location":"31.208739, 121.518305","name":"上海浦东喜来登由由大酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/36t2KUGs4h5YgYSaLSkr5pMXLM54_w200_h200_c1_t0.jpg","price":2489,"score":45,"starName":"五星级"}
{"address":"崂山路689号","brand":"7天酒店","business":"浦东陆家嘴金融贸易区","city":"上海","id":200214824,"location":"31.220656, 121.525127","name":"7天连锁酒店(上海陆家嘴八佰伴店)","pic":"https://m.tuniucdn.com/fb2/t1/G1/M00/3D/95/Cii9EVkx0JCIRDFfAAIMnl8npiYAALaawHMG2kAAgy2536_w200_h200_c1_t0.jpg","price":249,"score":36,"starName":"二钻"}
{"address":"博园路6555号","brand":"皇冠假日","business":"嘉定新城","city":"上海","id":200215226,"location":"31.272533, 121.19179","name":"上海颖奕皇冠假日酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3Uyfi2aBRETE1K5PChiLVZCwtDLF_w200_h200_c1_t0.jpg","price":907,"score":45,"starName":"五钻"}
{"address":"虹桥路2270号","brand":"万豪","business":"虹桥地区","city":"上海","id":200215286,"location":"31.191529, 121.375577","name":"上海万豪虹桥大酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/52/B6/Cii-TF3eXK6IBQoRAAbgs1dyxJwAAGRfAPXbPQABuDL314_w200_h200_c1_t0.jpg","price":910,"score":46,"starName":"五星级"}
{"address":"虹梅路2971号","brand":"如家","business":"虹桥地区","city":"上海","id":200215365,"location":"31.180968, 121.392415","name":"如家酒店(上海虹桥漕河泾古北店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2WPfVp6auQkYoHzAdSbxwHAtQFfa_w200_h200_c1_t0.jpg","price":189,"score":44,"starName":"二钻"}
{"address":"松江九亭镇中心路128号","brand":"速8","business":"七宝古镇","city":"上海","id":200215548,"location":"31.119363, 121.322768","name":"速8酒店(上海虹桥枢纽九亭中心路店)","pic":"https://m.tuniucdn.com/fb2/t1/G1/M00/42/40/Cii-U1kziVOIGTw-AAGRMfcIwJwAALi6ACRnUsAAZFJ536_w200_h200_c1_t0.jpg","price":198,"score":39,"starName":"二钻"}
{"address":"奉贤沪杭公路1758-8号","brand":"维也纳","business":"奉贤开发区","city":"上海","id":200216665,"location":"30.934646, 121.451449","name":"维也纳酒店(上海奉贤南桥中心店)","pic":"https://m.tuniucdn.com/fb2/t1/G2/M00/DC/A8/Cii-T1kw5leIQAA3AAFzNYtL4loAAK9OQOyk4sAAXNN152_w200_h200_c1_t0.jpg","price":1289,"score":38,"starName":"三钻"}
{"address":"宝安区章阁村桂月路章阁市场汇龙峰景一期A栋2-4层","brand":"7天酒店","business":"观澜","city":"深圳","id":219484323,"location":"22.746493, 114.023","name":"7天连锁酒店(深圳观澜章阁店)","pic":"https://m.tuniucdn.com/fb2/t1/G1/M00/3C/8C/Cii-U1kxXqaIeqeuAAHwF4GDmOcAALYFQI9zMMAAfAv100_w200_h200_c1_t0.jpg","price":725,"score":40,"starName":"二钻"}
{"address":"深南中路2081号","brand":"和颐","business":"华强北商业区","city":"深圳","id":223318960,"location":"22.540313, 114.088611","name":"和颐酒店(深圳深南大道华强路地铁站店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2M7am7D8rPTeTQAhxqBeMSANaqGr_w200_h200_c1_t0.jpg","price":637,"score":46,"starName":"四钻"}
{"address":"朱泾镇文商路79号","brand":"7天酒店","business":"金山枫泾古镇地区","city":"上海","id":233036941,"location":"30.895912, 121.160238","name":"7天连锁酒店(上海东林寺店)","pic":"https://m.tuniucdn.com/fb2/t1/G4/M00/35/13/Cii_J1zr5PyIY3acAAFCnHJPxLUAAGX-ABvcIMAAUK0087_w200_h200_c1_t0.jpg","price":218,"score":37,"starName":"二钻"}
{"address":"朝阳北路八里庄南里26号","brand":"如家","business":"国贸地区","city":"北京","id":234719711,"location":"39.922472, 116.501118","name":"如家酒店·neo(北京朝阳北路十里堡地铁站店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2rHdXNCmycnUxw99AniFC25ZDSfJ_w200_h200_c1_t0.jpg","price":378,"score":47,"starName":"二钻"}
{"address":"房山城关镇城隍庙街10号(原房山老公安局)","brand":"速8","business":"","city":"北京","id":234719728,"location":"39.705216, 115.981904","name":"速8酒店(北京房山城关店)","pic":"https://m.tuniucdn.com/fb2/t1/G1/M00/3F/66/Cii9EFkyeImIB3ZVAAHcTtTFt4oAALdsgICDO0AAdxm378_w200_h200_c1_t0.jpg","price":392,"score":47,"starName":"二钻"}
{"address":"丰葆路106号","brand":"和颐","business":"总部基地/丰台体育中心/南宫地区","city":"北京","id":235196477,"location":"39.815383, 116.291012","name":"和颐酒店(北京总部基地店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3J7Hcvwt5xZJL3NkS4wPJ6csmFb9_w200_h200_c1_t0.jpg","price":379,"score":45,"starName":"四钻"}
{"address":"菊园新区嘉唐公路66号","brand":"喜来登","business":"嘉定新城","city":"上海","id":339777429,"location":"31.394595, 121.245773","name":"上海嘉定喜来登酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2v2fKuo5bzhunSBC1n1E42cLTkZV_w200_h200_c1_t0.jpg","price":1286,"score":44,"starName":"五钻"}
{"address":"良乡西路7号","brand":"如家","business":"房山风景区","city":"北京","id":339952837,"location":"39.73167, 116.132482","name":"如家酒店(北京良乡西路店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3Dpgf5RTTzrxpeN5y3RLnRVtxMEA_w200_h200_c1_t0.jpg","price":159,"score":46,"starName":"二钻"}
{"address":"东北旺西路8号中关村软件园一期9号楼","brand":"和颐","business":"上地产业园/西三旗","city":"北京","id":343341695,"location":"40.044663, 116.29607","name":"和颐酒店(北京中关村软件园店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3hSkPeWRQ3VK1heRQpHzJNMTanQz_w200_h200_c1_t0.jpg","price":245,"score":47,"starName":"四钻"}
{"address":"鲁谷东街甲26号","brand":"和颐","business":"公主坟/五棵松/石景山游乐园地区","city":"北京","id":365011120,"location":"39.895479, 116.240386","name":"和颐酒店(北京石景山万达广场店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3iwohdQzyZP9azUkYAwTFj7WzBwd_w200_h200_c1_t0.jpg","price":505,"score":47,"starName":"四钻"}
{"address":"博兴路1119号","brand":"如家","business":"浦东金桥地区","city":"上海","id":368343863,"location":"31.266272, 121.593829","name":"如家酒店(上海金桥博兴路地铁站店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/w5ERtGJEmdgdgy5qtLPatR1xfm4_w200_h200_c1_t0.jpg","price":218,"score":45,"starName":"二钻"}
{"address":"福田深南大道1003号","brand":"希尔顿","business":"会展中心/CBD","city":"深圳","id":368701368,"location":"22.539313, 114.069763","name":"深圳大中华希尔顿酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/4EnHseZ73LXdFJY7DSdJ8xqAcjXe_w200_h200_c1_t0.jpg","price":1666,"score":46,"starName":"五钻"}
{"address":"松岗镇河滨北路12号盛华大厦","brand":"汉庭","business":"松岗商业中心区","city":"深圳","id":1393017952,"location":"22.768912, 113.83325","name":"汉庭酒店(深圳宝安松岗地铁站店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/4NehRjdHyZDKxTjAxTYv27FHq8LJ_w200_h200_c1_t0.jpg","price":166,"score":47,"starName":"二钻"}
{"address":"龙岗大道横岗段4004号","brand":"如家","business":"龙岗中心区/大运新城","city":"深圳","id":1400304687,"location":"22.642629, 114.202799","name":"如家酒店(深圳横岗地铁站新马商贸城店)","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/25/5A/Cii-TF3PFkiIb27dAAEqdDcKl3YAAEViQGVWY0AASqM960_w200_h200_c1_t0.jpg","price":149,"score":43,"starName":"二钻"}
{"address":"海德一道88号中洲控股中心A座","brand":"万豪","business":"海岸城/后海","city":"深圳","id":1406627919,"location":"22.517293, 113.933785","name":"深圳中洲万豪酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3wsinQAcuWtCdmv1yxauVG2PSYpC_w200_h200_c1_t0.jpg","price":204,"score":47,"starName":"五钻"}
{"address":"金海路2449弄2号","brand":"丽笙","business":"浦东金桥地区","city":"上海","id":1418471719,"location":"31.26571, 121.650132","name":"上海宝龙丽笙酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3myGUurFCriEVMGPy9yYMPFdb9Zh_w200_h200_c1_t0.jpg","price":860,"score":46,"starName":"五钻"}
{"address":"西乡河西金雅新苑34栋","brand":"如家","business":"宝安商业区","city":"深圳","id":1455383931,"location":"22.590272, 113.881933","name":"如家酒店(深圳宝安客运中心站店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2w9cbbpzjjsyd2wRhFrnUpBMT8b4_w200_h200_c1_t0.jpg","price":169,"score":45,"starName":"二钻"}
{"address":"珠光北路280号天下湘军1楼","brand":"7天酒店","business":"大学城/西丽动物园","city":"深圳","id":1457521002,"location":"22.576187, 113.956166","name":"7天连锁酒店(深圳西丽茶光地铁站店)","pic":"https://m.tuniucdn.com/fb2/t1/G2/M00/E3/E0/Cii-Tlkzdl6IfQYfAAHCgNVDe1sAALK6gPBDhQAAcKY242_w200_h200_c1_t0.jpg","price":517,"score":39,"starName":"二钻"}
{"address":"沪南公路2653-2号","brand":"豪生","business":"周浦康桥地区","city":"上海","id":1463484295,"location":"31.146478, 121.568218","name":"上海和平豪生酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/ZxM9gWHqj657ndRsHw4j4p3CQ5k_w200_h200_c1_t0.jpg","price":650,"score":41,"starName":"四钻"}
{"address":"东川路2645号","brand":"如家","business":"交大/闵行经济开发区","city":"上海","id":1514269829,"location":"31.008875, 121.402813","name":"如家酒店(上海东川路碧江商业广场店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/R92UunuCRXiG826G9Ptu7orqs7b_w200_h200_c1_t0.jpg","price":218,"score":45,"starName":"二钻"}
{"address":"罗湖区东门新园路37号益德楼","brand":"维也纳","business":"东门商业区","city":"深圳","id":1557882030,"location":"22.549413, 114.118866","name":"维也纳酒店(深圳东门老街店)","pic":"https://m.tuniucdn.com/fb2/t1/G1/M00/45/83/Cii9EFk0opCIPl9CAAKHl3Egm6oAALoKwLNWlwAAoev470_w200_h200_c1_t0.jpg","price":336,"score":43,"starName":"三钻"}
{"address":"国定东路88号","brand":"凯悦","business":"江湾/五角场商业区","city":"上海","id":1557997004,"location":"31.300645, 121.51918","name":"上海五角场凯悦酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3a3Zz9cDgbJEEJ1GcXzKhTh21YqK_w200_h200_c1_t0.jpg","price":1104,"score":46,"starName":"五钻"}
{"address":"秀浦路3999弄17号","brand":"万怡","business":"迪士尼度假区","city":"上海","id":1565094427,"location":"31.132913, 121.63464","name":"上海国际旅游度假区万怡酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/KPBUPunPDETYWg8WaJDSmiZC65z_w200_h200_c1_t0.jpg","price":713,"score":45,"starName":"四钻"}
{"address":"御青路315-317号","brand":"如家","business":"周浦康桥地区","city":"上海","id":1584362548,"location":"31.15719, 121.572392","name":"如家酒店(上海浦东国际旅游度假区御桥地铁站店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2ybd3wqdoBtBeKcPxmyso9y1hNXa_w200_h200_c1_t0.jpg","price":339,"score":44,"starName":"二钻"}
{"address":"罗湖区宝安南路2078号深港豪苑(与红桂路交汇处)","brand":"7天酒店","business":"","city":"深圳","id":1630005459,"location":"22.550341, 114.10965","name":"7天连锁酒店(深圳地王大厦红桂路店)(原红桂路店)","pic":"https://m.tuniucdn.com/fb2/t1/G2/M00/EA/18/Cii-T1k1KaGIIkQVAAD4fD_T3FcAALTtABiCJ8AAPiU164_w200_h200_c1_t0.jpg","price":143,"score":39,"starName":"二钻"}
{"address":"西城北京市西城区德胜门内大街兴华胡同五福里2号","brand":"速8","business":"后海","city":"北京","id":1637944903,"location":"39.934452, 116.38184","name":"速8酒店北京后海店","pic":"https://m.tuniucdn.com/fb2/t1/G1/M00/48/0C/Cii9EVk1JNuILdBWAAHv5O89TjMAALrFgJ8bwcAAe_8197_w200_h200_c1_t0.jpg","price":213,"score":39,"starName":"二钻"}
{"address":"华夏东路811号","brand":"华美达","business":"迪士尼度假区","city":"上海","id":1649956165,"location":"31.195206, 121.664791","name":"上海南青华美达酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2RHmQgTpte3UVSDJ5KbqobbZGRnE_w200_h200_c1_t0.jpg","price":299,"score":47,"starName":"四钻"}
{"address":"黄寺大街12号院16号楼","brand":"速8","business":"马甸、安贞地区","city":"北京","id":1714520967,"location":"39.962742, 116.388431","name":"速8酒店(北京安华桥黄寺大街店)","pic":"https://m.tuniucdn.com/fb2/t1/G1/M00/4A/21/Cii-U1k1o-uIdcUZAAIbmIKVlKAAALtvQGBb6kAAhuw170_w200_h200_c1_t0.jpg","price":559,"score":43,"starName":"二钻"}
{"address":"广富林路600弄7号","brand":"华美达","business":"佘山/松江大学城","city":"上海","id":1725781423,"location":"31.058023, 121.246536","name":"上海三迪华美达酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/NoHym6tuKwVazxy33wRNTNuQWd2_w200_h200_c1_t0.jpg","price":690,"score":43,"starName":"四钻"}
{"address":"大鹏街道新园街12号","brand":"汉庭","business":"较场尾/大鹏所城","city":"深圳","id":1734220581,"location":"22.592661, 114.475167","name":"汉庭酒店(深圳大鹏佳兆业店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3nWzyWt63gtwPzRf5xbHvwKM27vU_w200_h200_c1_t0.jpg","price":378,"score":43,"starName":"二钻"}
{"address":"宁夏路718号","brand":"凯悦","business":"中山公园商业区","city":"上海","id":1754929048,"location":"31.232041, 121.412492","name":"上海环球港凯悦酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/45/B6/Cii-U13ZY-CIF-8MAAXkwQoY7FIAAFpQgEE1bgABeTZ750_w200_h200_c1_t0.jpg","price":1336,"score":45,"starName":"五钻"}
{"address":"棕榈大道33号","brand":"万豪","business":"较场尾/大鹏所城","city":"深圳","id":1762661667,"location":"22.569193, 114.459325","name":"深圳佳兆业万豪酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/45/EC/Cii-TF3ZqE-IYM0NAAY6GIHLZNsAAFr2QDhR8EABjow444_w200_h200_c1_t0.jpg","price":223,"score":46,"starName":"五钻"}
{"address":"西直门北大街49号","brand":"如家","business":"西直门/北京展览馆地区","city":"北京","id":1765008760,"location":"39.945106, 116.353827","name":"如家酒店(北京西直门北京北站店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/4CLwbCE9346jYn7nFsJTQXuBExTJ_w200_h200_c1_t0.jpg","price":356,"score":44,"starName":"二钻"}
{"address":"揽海路2888号","brand":"喜来登","business":"崇明岛/长兴岛/横沙岛","city":"上海","id":1880614409,"location":"31.462167, 121.823103","name":"上海崇明由由喜来登酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/21gDCGgRT3xFqCd3FxBh633j6Qsu_w200_h200_c1_t0.jpg","price":2198,"score":45,"starName":"五钻"}
{"address":"西三环南路44号-218","brand":"如家","business":"北京西站/丽泽商务区","city":"北京","id":1889333146,"location":"39.869638, 116.313075","name":"如家酒店(北京西客站丽泽桥店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/kG5corYUDC7U1qE8RAY6xCVnGxq_w200_h200_c1_t0.jpg","price":459,"score":47,"starName":"二钻"}
{"address":"陈行公路3701号","brand":"皇冠假日","business":"浦江镇地区","city":"上海","id":1908594080,"location":"31.090063, 121.489728","name":"上海建工浦江皇冠假日酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/45/B7/Cii-U13ZZDWIePrGAAPyImW93N0AAFpRgMmj4MAA_I6005_w200_h200_c1_t0.jpg","price":843,"score":46,"starName":"五钻"}
{"address":"蟠文路333号","brand":"万怡","business":"虹桥机场/国家会展中心","city":"上海","id":1913922369,"location":"31.185504, 121.287709","name":"上海中建万怡酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/39Afm5Bxgd784eMeFB5DrcsPnhT_w200_h200_c1_t0.jpg","price":889,"score":47,"starName":"四钻"}
{"address":"丹巴路99号","brand":"万怡","business":"长风公园地区","city":"上海","id":1916002015,"location":"31.22292, 121.379912","name":"上海苏宁环球万怡酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/svpYHdmVDck91NqAhjtngcXth2G_w200_h200_c1_t0.jpg","price":689,"score":45,"starName":"四钻"}
{"address":"康新公路4499号","brand":"万豪","business":"迪士尼度假区","city":"上海","id":1928731731,"location":"31.119187, 121.618966","name":"上海康桥万豪酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3inpPxTnvRjMCEB39K9FuHaXohYw_w200_h200_c1_t0.jpg","price":811,"score":46,"starName":"五钻"}
{"address":"宝安国际机场地面交通中心(GTC)18号出口","brand":"凯悦","business":"宝安机场商圈","city":"深圳","id":1931442052,"location":"22.622498, 113.812341","name":"深圳机场凯悦酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/45/EC/Cii-TF3ZqVeIJcTPAAUq_Ou_CrcAAFr4gKufPUABSsU446_w200_h200_c1_t0.jpg","price":291,"score":47,"starName":"五钻"}
{"address":"松岗东方大道46号","brand":"万怡","business":"松岗商业中心区","city":"深圳","id":1931602865,"location":"22.760746, 113.856961","name":"深圳联投东方万怡酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/45/EC/Cii-U13ZqVyIOjdpAARI9aeBh-IAAFr4gOQh7oABEkN297_w200_h200_c1_t0.jpg","price":688,"score":45,"starName":"五钻"}
{"address":"广顺南大街8号院2号楼","brand":"凯悦","business":"望京/酒仙桥/798地区","city":"北京","id":1937347815,"location":"39.991546, 116.476288","name":"北京望京凯悦酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2gLT4ZgJ8ZuS7sSmXzYoCXnV248p_w200_h200_c1_t0.jpg","price":617,"score":46,"starName":"五钻"}
{"address":"城南街道南口路29号","brand":"万豪","business":"昌平城区/十三陵度假区","city":"北京","id":1942938880,"location":"40.23264, 116.188888","name":"北京乐多港万豪酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3mBWaZeaqq54E7kX2n7g9b2CZX6q_w200_h200_c1_t0.jpg","price":227,"score":45,"starName":"五钻"}
{"address":"裕民南路1366号","brand":"凯悦","business":"嘉定新城","city":"上海","id":1942992995,"location":"31.352298, 121.263314","name":"上海嘉定凯悦酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/53/2D/Cii-U13edkqIfZhLAAJEW25WIF4AAGVxQIg38sAAkRz517_w200_h200_c1_t0.jpg","price":758,"score":46,"starName":"五钻"}
{"address":"福海街道宝安大道 6259号","brand":"万怡","business":"深圳国际会展中心商圈","city":"深圳","id":1951709780,"location":"22.678611, 113.805695","name":"深圳同泰万怡酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3oUfktphxMAWq9hUxD9uqdjRdZGB_w200_h200_c1_t0.jpg","price":617,"score":48,"starName":"五钻"}
{"address":"科技南路16号","brand":"万怡","business":"科技园","city":"深圳","id":1973839294,"location":"22.531101, 113.950615","name":"深圳湾万怡酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/8C9QscRsvTWCx92wt17GAegEMFn_w200_h200_c1_t0.jpg","price":508,"score":47,"starName":"五钻"}
{"address":"南商路84-6号","brand":"如家","business":"海岸城/后海","city":"深圳","id":1975922994,"location":"22.513566, 113.9291","name":"如家酒店·neo(深圳南山海岸城南油地铁站店)","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/25/5E/Cii-TF3PGD-IQ0FcAAFIZC82AnkAAEVvAKdj4YAAUh8638_w200_h200_c1_t0.jpg","price":238,"score":44,"starName":"二钻"}
{"address":"留仙大道4088号","brand":"喜来登","business":"大学城/西丽动物园","city":"深圳","id":1989806195,"location":"22.582918, 113.97219","name":"深圳博林天瑞喜来登酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/4Rx55fZoneUeKbE3TCRSPB6WQ6bw_w200_h200_c1_t0.jpg","price":1369,"score":48,"starName":"五钻"}
{"address":"紫星路588号3幢","brand":"万怡","business":"交大/闵行经济开发区","city":"上海","id":1996823660,"location":"31.02118, 121.465186","name":"上海紫竹万怡酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/53/2F/Cii-TF3edraIPzK9AAH_p8vdHKoAAGV3AJgSVEAAf-_019_w200_h200_c1_t0.jpg","price":642,"score":46,"starName":"四钻"}
{"address":"清河小营西路48号汇苑仁和大厦一层","brand":"和颐","business":"上地产业园/西三旗","city":"北京","id":1997830708,"location":"40.034623, 116.323925","name":"和颐至尚酒店(北京上地软件园店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2sKjxS1hFYyBFVKVBqo2x2hSFvGj_w200_h200_c1_t0.jpg","price":753,"score":47,"starName":"四钻"}
{"address":"新松江路1277号","brand":"万怡","business":"佘山/松江大学城","city":"上海","id":2003479905,"location":"31.038198, 121.210178","name":"上海榕港万怡酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2GM761BYH8k15qkNrJrja3cwfr2D_w200_h200_c1_t0.jpg","price":798,"score":46,"starName":"四钻"}
{"address":"府前二街6号","brand":"和颐","business":"首都机场/新国展地区","city":"北京","id":2009548883,"location":"40.063953, 116.576829","name":"和颐至尚酒店(北京首都机场新国展店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/43zCTomkMSkUfZByZxn77YH2XidJ_w200_h200_c1_t0.jpg","price":611,"score":46,"starName":"三钻"}
{"address":"阜康南路1号院1号楼A","brand":"凯悦","business":"延庆休闲度假区","city":"北京","id":2011785622,"location":"40.440732, 115.963259","name":"北京世园凯悦酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/uhGcQze3zZQxe4avSU8BysgYVvx_w200_h200_c1_t0.jpg","price":558,"score":47,"starName":"五星级"}
{"address":"南奉公路3111弄228号","brand":"喜来登","business":"奉贤开发区","city":"上海","id":2022598930,"location":"30.921659, 121.575572","name":"上海宝华喜来登酒店","pic":"https://m.tuniucdn.com/fb2/t1/G6/M00/45/BD/Cii-TF3ZaBmIStrbAASnoOyg7FoAAFpYwEoz9oABKe4992_w200_h200_c1_t0.jpg","price":2899,"score":46,"starName":"五钻"}
{"address":"海景二路1025号1-6层、30-50层","brand":"凯悦","business":"盐田区政府/沙头角","city":"深圳","id":2022881967,"location":"22.551323, 114.23781","name":"深圳盐田凯悦酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2RFMLSujkczEn1HoybD6dUpN9pzr_w200_h200_c1_t0.jpg","price":650,"score":47,"starName":"五钻"}
{"address":"小黄庄1区15号","brand":"和颐","business":"马甸/安贞地区","city":"北京","id":2031683181,"location":"39.962361, 116.412931","name":"和颐至尚酒店(北京雍和宫和平里店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/4Xqm5BN9pZTamwmYS3eLxL417YYt_w200_h200_c1_t0.jpg","price":299,"score":47,"starName":"四钻"}
{"address":"展云路6号","brand":"皇冠假日","business":"深圳国际会展中心商圈","city":"深圳","id":2045052822,"location":"22.686581, 113.777655","name":"深圳国际会展中心皇冠假日酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/4DGZygQpE4iSpcBDCoXJvjNr4oiR_w200_h200_c1_t0.jpg","price":675,"score":47,"starName":"五钻"}
{"address":"高米店南里18号楼","brand":"希尔顿","business":"大兴北京新机场地区","city":"北京","id":2048042240,"location":"39.76875, 116.339199","name":"北京大兴希尔顿酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3B32F8zSU2CJCWzs1hoH2o4WcquR_w200_h200_c1_t0.jpg","price":1283,"score":48,"starName":"五钻"}
{"address":"丽泽金融商务区凤凰嘴北路与金中都西路交叉口西营街8号院1号楼","brand":"喜来登","business":"北京西站/丽泽商务区","city":"北京","id":2048047291,"location":"39.864026, 116.322505","name":"北京新青海喜来登酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/4DPQMu5sMM7XR1mvcjoqtWngc7TF_w200_h200_c1_t0.jpg","price":723,"score":47,"starName":"五钻"}
{"address":"新和路127-2号","brand":"汉庭","business":"坪山高铁站商圈","city":"深圳","id":2048050570,"location":"22.700753, 114.339089","name":"汉庭酒店(深圳坪山火车站店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2nXN2bWjfoqoTkPwHvLJQPYz17qD_w200_h200_c1_t0.jpg","price":436,"score":47,"starName":"二钻"}
{"address":"观湖街道五和大道327号","brand":"汉庭","business":"观澜","city":"深圳","id":2048671293,"location":"22.684459, 114.07708","name":"汉庭酒店(深圳观澜五和大道店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2JrQi83S9qgDEkXqWpe5iyi44Uh2_w200_h200_c1_t0.jpg","price":234,"score":43,"starName":"二钻"}
{"address":"桂园街道宝安南路1050号嘉宾花园C栋","brand":"汉庭","business":"万象城/京基100","city":"深圳","id":2051661320,"location":"22.540352, 114.112668","name":"汉庭酒店(深圳罗湖口岸万象城二店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/34FRP7HLPhvKZP1a6tXu4XrJeiaw_w200_h200_c1_t0.jpg","price":667,"score":47,"starName":"三钻"}
{"address":"新华东街289号2号楼","brand":"希尔顿","business":"果园环岛/通州区","city":"北京","id":2056105938,"location":"39.908805, 116.659748","name":"北京通州北投希尔顿酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/NGKdpec3tZJNUUNWJ5pd67Cp5AY_w200_h200_c1_t0.png","price":1068,"score":48,"starName":"五钻"}
{"address":"申长路630弄1-3 号","brand":"皇冠假日","business":"虹桥机场/国家会展中心","city":"上海","id":2056126831,"location":"31.19036, 121.31535","name":"上海虹桥金臣皇冠假日酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/PvFh4Vzc84xXhm5N41F6AqdAqyJ_w200_h200_c1_t0.jpg","price":2488,"score":48,"starName":"五钻"}
{"address":"深南大道9819号","brand":"皇冠假日","business":"科技园","city":"深圳","id":2056132395,"location":"22.538923, 113.944794","name":"深圳深铁皇冠假日酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/eBLtrED2uJs7yURWfjnWge9dT1P_w200_h200_c1_t0.jpg","price":340,"score":47,"starName":"五钻"}
{"address":"沪南公路7688弄1号","brand":"万豪","business":"南汇/野生动物园","city":"上海","id":2056298828,"location":"31.030053, 121.662943","name":"上海中优城市万豪酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2gBATEyysyQWmw3wZL863HGdqjaq_w200_h200_c1_t0.jpg","price":1200,"score":45,"starName":"五钻"}
{"address":"粤海街道高新区社区科技南路18号","brand":"万丽","business":"科技园","city":"深圳","id":2058250574,"location":"22.531674, 113.951882","name":"深圳湾万丽酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2YWUpZsvPVkRiKgdPg95LJxaFmB6_w200_h200_c1_t0.jpg","price":351,"score":47,"starName":"五钻"}
{"address":"妫水北街1号1-14幢","brand":"皇冠假日","business":"延庆休闲度假区","city":"北京","id":2060510277,"location":"40.476483, 115.97481","name":"北京金隅八达岭皇冠假日酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/3Dzq2KxgiQbmb1sbc5iK6xqpVuFr_w200_h200_c1_t0.jpg","price":1026,"score":44,"starName":"五钻"}
{"address":"粤海街道后海社区后海第二统建楼商业裙楼第二层B","brand":"汉庭","business":"海岸城/后海","city":"深圳","id":2060618247,"location":"22.507276, 113.931251","name":"汉庭酒店(深圳海岸城店)","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/TBoXdgEx5Yjc2HobeC3fPWWnSJi_w200_h200_c1_t0.jpg","price":562,"score":49,"starName":"二钻"}
{"address":"展丰路80号","brand":"希尔顿","business":"深圳国际会展中心商圈","city":"深圳","id":2062643512,"location":"22.705335, 113.77794","name":"深圳国际会展中心希尔顿酒店","pic":"https://m.tuniucdn.com/fb3/s1/2n9c/2SHUVXNrN5NsXsTUwcd1yaHKbrGq_w200_h200_c1_t0.jpg","price":285,"score":46,"starName":"五钻"}
使用场景
全文检索查询的基本流程如下:
- 对用户搜索的内容做分词,得到词条
- 根据词条去倒排索引库中匹配,得到文档id
- 根据文档id找到文档,返回给用户
比较常用的场景包括:
- 商城的输入框搜索
- 百度输入框搜索
例如京东:
因为是拿着词条去匹配,因此参与搜索的字段也必须是可分词的text类型的字段。
基本语法
常见的全文检索查询包括:
- match查询:单字段查询
- multi_match查询:多字段查询,任意一个字段符合条件就算符合查询条件
match查询语法如下:
GET /indexName/_search
{
"query": {
"match": {
"FIELD": "TEXT"
}
}
}
mulit_match语法如下:
GET /indexName/_search
{
"query": {
"multi_match": {
"query": "TEXT",
"fields": ["FIELD1", "FIELD12"]
}
}
}
示例
match查询示例
multi_match查询示例:
- 根据brand、name、business字段查询
可以看到,两种查询结果是一样的,为什么?
因为我们将brand、name、business值都利用copy_to复制到了all字段中。因此你根据三个字段搜索,和根据all字段搜索效果当然一样了。
但是,搜索字段越多,对查询性能影响越大,因此建议采用copy_to,然后单字段查询的方式。
总结
match和multi_match的区别是什么?
- match:根据一个字段查询
- multi_match:根据多个字段查询,参与查询字段越多,查询性能越差
精准查询
精确查询一般是查找keyword、数值、日期、boolean等类型字段。所以不会对搜索条件分词。常见的有:
- term:根据词条精确值查询
- range:根据值的范围查询
term查询
因为精确查询的字段搜是不分词的字段,因此查询的条件也必须是不分词的词条。查询时,用户输入的内容跟自动值完全匹配时才认为符合条件。如果用户输入的内容过多,反而搜索不到数据。
语法说明:
// term查询
GET /indexName/_search
{
"query": {
"term": {
"FIELD": {
"value": "VALUE"
}
}
}
}
示例
当我搜索的是精确词条时,能正确查询出结果:
但是,当我搜索的内容不是词条,而是多个词语形成的短语时,反而搜索不到:
range查询
范围查询,一般应用在对数值类型做范围过滤的时候。比如做价格范围过滤。
基本语法:
// range查询
GET /indexName/_search
{
"query": {
"range": {
"FIELD": {
"gte": 10, // 这里的gte代表大于等于,gt则代表大于
"lte": 20 // lte代表小于等于,lt则代表小于
}
}
}
}
示例:
总结
精确查询常见的有哪些?
- term查询:根据词条精确匹配,一般搜索keyword类型、数值类型、布尔类型、日期类型字段
- range查询:根据数值范围查询,可以是数值、日期的范围
地理坐标查询
所谓的地理坐标查询,其实就是根据经纬度查询,官方文档:https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-queries.html
常见的使用场景包括:
- 携程:搜索我附近的酒店
- 滴滴:搜索我附近的出租车
- 微信:搜索我附近的人
附近的酒店:
矩形范围查询
矩形范围查询,也就是geo_bounding_box查询,查询坐标落在某个矩形范围的所有文档:
查询时,需要指定矩形的左上、右下两个点的坐标,然后画出一个矩形,落在该矩形内的都是符合条件的点。
语法如下:
// geo_bounding_box查询
GET /indexName/_search
{
"query": {
"geo_bounding_box": {
"FIELD": {
"top_left": { // 左上点
"lat": 31.1,
"lon": 121.5
},
"bottom_right": { // 右下点
"lat": 30.9,
"lon": 121.7
}
}
}
}
}
这种并不符合“附近的人”这样的需求。
附近查询
附近查询,也叫做距离查询(geo_distance):查询到指定中心点小于某个距离值的所有文档。
换句话来说,在地图上找一个点作为圆心,以指定距离为半径,画一个圆,落在圆内的坐标都算符合条件:
语法说明:
// geo_distance 查询
GET /indexName/_search
{
"query": {
"geo_distance": {
"distance": "15km", // 半径
"FIELD": "31.21,121.5" // 圆心
}
}
}
示例:
我们先搜索陆家嘴附近15km的酒店:
发现共有47家酒店。
然后把半径缩短到3公里:
可以发现,搜索到的酒店数量减少到了5家。
复合查询
复合(compound)查询:复合查询可以将其它简单查询组合起来,实现更复杂的搜索逻辑。常见的有两种:
- fuction score:算分函数查询,可以控制文档相关性算分,控制文档排名
- bool query:布尔查询,利用逻辑关系组合多个其它的查询,实现复杂搜索
相关性算分
当我们利用match查询时,文档结果会根据与搜索词条的关联度打分(_score),返回结果时按照分值降序排列。
例如,我们搜索 “虹桥如家”,结果如下:
[
{
"_score" : 17.850193,
"_source" : {
"name" : "虹桥如家酒店真不错",
}
},
{
"_score" : 12.259849,
"_source" : {
"name" : "外滩如家酒店真不错",
}
},
{
"_score" : 11.91091,
"_source" : {
"name" : "迪士尼如家酒店真不错",
}
}
]
在elasticsearch中,早期使用的打分算法是TF-IDF算法,公式如下:
在后来的5.1版本升级中,elasticsearch将算法改进为BM25算法,公式如下:
TF-IDF算法有一各缺陷,就是词条频率越高,文档得分也会越高,单个词条对文档影响较大。而BM25则会让单个词条的算分有一个上限,曲线更加平滑:
小结:elasticsearch会根据词条和文档的相关度做打分,算法由两种:
- TF-IDF算法
- BM25算法,elasticsearch5.1版本后采用的算法
算分函数查询
根据相关度打分是比较合理的需求,但合理的不一定是产品经理需要的。
以百度为例,你搜索的结果中,并不是相关度越高排名越靠前,而是谁掏的钱多排名就越靠前。如图:
要想认为控制相关性算分,就需要利用elasticsearch中的function score 查询了。
语法说明
function score 查询中包含四部分内容:
- 原始查询条件:query部分,基于这个条件搜索文档,并且基于BM25算法给文档打分,原始算分(query score)
- 过滤条件:filter部分,符合该条件的文档才会重新算分
- 算分函数:符合filter条件的文档要根据这个函数做运算,得到的函数算分(function score),有四种函数
- weight:函数结果是常量
- field_value_factor:以文档中的某个字段值作为函数结果
- random_score:以随机数作为函数结果
- script_score:自定义算分函数算法
- 运算模式:算分函数的结果、原始查询的相关性算分,两者之间的运算方式,包括:
- multiply:相乘
- replace:用function score替换query score
- 其它,例如:sum、avg、max、min
function score的运行流程如下:
- 1)根据原始条件查询搜索文档,并且计算相关性算分,称为原始算分(query score)
- 2)根据过滤条件,过滤文档
- 3)符合过滤条件的文档,基于算分函数运算,得到函数算分(function score)
- 4)将原始算分(query score)和函数算分(function score)基于运算模式做运算,得到最终结果,作为相关性算分。
因此,其中的关键点是:
- 过滤条件:决定哪些文档的算分被修改
- 算分函数:决定函数算分的算法
- 运算模式:决定最终算分结果
示例
需求:给“如家”这个品牌的酒店排名靠前一些
翻译一下这个需求,转换为之前说的四个要点:
- 原始条件:不确定,可以任意变化
- 过滤条件:brand = “如家”
- 算分函数:可以简单粗暴,直接给固定的算分结果,weight
- 运算模式:比如求和
因此最终的DSL语句如下:
GET /hotel/_search
{
"query": {
"function_score": {
"query": { .... }, // 原始查询,可以是任意条件
"functions": [ // 算分函数
{
"filter": { // 满足的条件,品牌必须是如家
"term": {
"brand": "如家"
}
},
"weight": 2 // 算分权重为2
}
],
"boost_mode": "sum" // 加权模式,求和
}
}
}
测试,在未添加算分函数时,如家得分如下:
GET /hotel/_search
{
"query":{
"function_score":{
"query": {"match": {"all": "外滩"}},
"functions": [
{
"filter": {"term": {"id": "1"}},
"weight": 10
}
],
"boost_mode": "multiply"
}
}
}
添加了算分函数后,如家得分就提升了:
Get /hotel/_search
{
"query": {
"function_score": {
"query": {
"match": {
"all": "外滩"
}
},
"functions": [{
"filter": {
"term": {
"brand": "如家"
}
},
"weight": 10
}
],
"boost_mode": "sum"
}
}
}
小结
function score query定义的三要素是什么?
- 过滤条件:哪些文档要加分
- 算分函数:如何计算function score
- 加权方式:function score 与 query score如何运算
布尔查询
布尔查询是一个或多个查询子句的组合,每一个子句就是一个子查询。子查询的组合方式有:
- must:必须匹配每个子查询,类似“与”
- should:选择性匹配子查询,类似“或”
- must_not:必须不匹配,不参与算分,类似“非”
- filter:必须匹配,不参与算分
比如在搜索酒店时,除了关键字搜索外,我们还可能根据品牌、价格、城市等字段做过滤:
每一个不同的字段,其查询的条件、方式都不一样,必须是多个不同的查询,而要组合这些查询,就必须用bool查询了。
需要注意的是,搜索时,参与打分的字段越多,查询的性能也越差。因此这种多条件查询时,建议这样做:
- 搜索框的关键字搜索,是全文检索查询,使用must查询,参与算分
- 其它过滤条件,采用filter查询。不参与算分
语法示例:
GET /hotel/_search
{
"query": {
"bool": {
"must": [
{"term": {"city": "上海" }}
],
"should": [
{"term": {"brand": "皇冠假日" }},
{"term": {"brand": "华美达" }}
],
"must_not": [
{ "range": { "price": { "lte": 500 } }}
],
"filter": [
{ "range": {"score": { "gte": 45 } }}
]
}
}
}
示例
需求:搜索名字包含“如家”,价格不高于400,在坐标31.21,121.5周围10km范围内的酒店。
分析:
- 名称搜索,属于全文检索查询,应该参与算分。放到must中
- 价格不高于400,用range查询,属于过滤条件,不参与算分。放到must_not中
- 周围10km范围内,用geo_distance查询,属于过滤条件,不参与算分。放到filter中
GET /hotel/_search
{
"query": {
"bool": {
"must": {
"match": {
"name": "如家"
}
},
"must_not": [
{
"range": {
"price": {
"gt": 400
}
}
}
],
"filter": [
{
"geo_distance": {
"distance": "10km",
"location": {
"lat": 31.21,
"lon": 121.5
}
}
}
]
}
}
}
小结
bool查询有几种逻辑关系?
- must:必须匹配的条件,可以理解为“与”
- should:选择性匹配的条件,可以理解为“或”
- must_not:必须不匹配的条件,不参与打分
- filter:必须匹配的条件,不参与打分
搜索结果处理
搜索的结果可以按照用户指定的方式去处理或展示。
排序
elasticsearch默认是根据相关度算分(_score)来排序,但是也支持自定义方式对搜索结果排序。可以排序字段类型有:keyword类型、数值类型、地理坐标类型、日期类型等。
普通字段排序
keyword、数值、日期类型排序的语法基本一致。
语法:
GET /indexName/_search
{
"query": {
"match_all": {}
},
"sort": [
{
"FIELD": "desc" // 排序字段、排序方式ASC、DESC
}
]
}
排序条件是一个数组,也就是可以写多个排序条件。按照声明的顺序,当第一个条件相等时,再按照第二个条件排序,以此类推
示例:
需求描述:酒店数据按照用户评价(score)降序排序,评价相同的按照价格(price)升序排序
GET /hotel/_search
{
"query": {
"match_all": {}
},
"sort": [
{
"score": "desc"
},
{
"price": "asc"
}
]
}
地理坐标排序
地理坐标排序略有不同。
语法说明:
GET /indexName/_search
{
"query": {
"match_all": {}
},
"sort": [
{
"_geo_distance" : {
"FIELD" : "纬度,经度", // 文档中geo_point类型的字段名、目标坐标点
"order" : "asc", // 排序方式
"unit" : "km" // 排序的距离单位
}
}
]
}
这个查询的含义是:
- 指定一个坐标,作为目标点
- 计算每一个文档中,指定字段(必须是geo_point类型)的坐标 到目标点的距离是多少
- 根据距离排序
示例:
需求描述:实现对酒店数据按照到你的位置坐标的距离升序排序
提示:获取你的位置的经纬度的方式:https://lbs.amap.com/demo/jsapi-v2/example/map/click-to-get-lnglat/
假设我的位置是:31.034661,121.612282,寻找我周围距离最近的酒店。
GET /hotel/_search
{
"query": {
"match_all": {}
},
"sort": [{
"_geo_distance": {
"location": {
"lat": 31.034661,
"lon": 121.612282
},
"order": "asc",
"unit": "km"
}
}
]
}
分页
elasticsearch 默认情况下只返回top10的数据。而如果要查询更多数据就需要修改分页参数了。elasticsearch中通过修改from、size参数来控制要返回的分页结果:
- from:从第几个文档开始
- size:总共查询几个文档
类似于mysql中的limit ?, ?
基本的分页
分页的基本语法如下:
GET /hotel/_search
{
"query": {
"match_all": {}
},
"from": 0, // 分页开始的位置,默认为0
"size": 10, // 期望获取的文档总数
"sort": [
{"price": "asc"}
]
}
GET /hotel/_search
{
"query": {
"match_all": {}
},
"sort": [
{
"price": "asc"
}
],
"from": 0,
"size": 10
}
// 如果你要查看第二页的数据, 就把 from 改成 10,
// 公式是 from : (page - 1) * size
深度分页问题
现在,我要查询990~1000的数据,查询逻辑要这么写:
GET /hotel/_search
{
"query": {
"match_all": {}
},
"from": 990, // 分页开始的位置,默认为0
"size": 10, // 期望获取的文档总数
"sort": [
{"price": "asc"}
]
}
这里是查询990开始的数据,也就是 第990~第1000条 数据。
不过,elasticsearch内部分页时,必须先查询 0~1000条,然后截取其中的990 ~ 1000的这10条:
查询TOP1000,如果es是单点模式,这并无太大影响。
但是elasticsearch将来一定是集群,例如我集群有5个节点,我要查询TOP1000的数据,并不是每个节点查询200条就可以了。
因为节点A的TOP200,在另一个节点可能排到10000名以外了。
因此要想获取整个集群的TOP1000,必须先查询出每个节点的TOP1000,汇总结果后,重新排名,重新截取TOP1000。
那如果我要查询9900~10000的数据呢?是不是要先查询TOP10000呢?那每个节点都要查询10000条?汇总到内存中?
当查询分页深度较大时,汇总数据过多,对内存和CPU会产生非常大的压力,因此elasticsearch会禁止from+ size 超过10000的请求。
针对深度分页,ES提供了两种解决方案,官方文档:
- search after:分页时需要排序,原理是从上一次的排序值开始,查询下一页数据。官方推荐使用的方式。
- scroll:原理将排序后的文档id形成快照,保存在内存。官方已经不推荐使用。
小结
分页查询的常见实现方案以及优缺点:
- from + size:
- 优点:支持随机翻页
- 缺点:深度分页问题,默认查询上限(from + size)是10000
- 场景:百度、京东、谷歌、淘宝这样的随机翻页搜索
- after search:
- 优点:没有查询上限(单次查询的size不超过10000)
- 缺点:只能向后逐页查询,不支持随机翻页
- 场景:没有随机翻页需求的搜索,例如手机向下滚动翻页
- scroll:
- 优点:没有查询上限(单次查询的size不超过10000)
- 缺点:会有额外内存消耗,并且搜索结果是非实时的
- 场景:海量数据的获取和迁移。从ES7.1开始不推荐,建议用 after search方案。
高亮
高亮原理
什么是高亮显示呢?
我们在百度,京东搜索时,关键字会变成红色,比较醒目,这叫高亮显示:
高亮显示的实现分为两步:
- 1)给文档中的所有关键字都添加一个标签,例如标签
- 2)页面给标签编写CSS样式
实现高亮
高亮的语法:
GET /hotel/_search
{
"query": {
"match": {
"FIELD": "TEXT" // 查询条件,高亮一定要使用全文检索查询
}
},
"highlight": {
"fields": { // 指定要高亮的字段
"FIELD": {
"pre_tags": "<em>", // 用来标记高亮字段的前置标签
"post_tags": "</em>" // 用来标记高亮字段的后置标签
}
}
}
}
注意:
- 高亮是对关键字高亮,因此搜索条件必须带有关键字,而不能是范围这样的查询。
- 默认情况下,高亮的字段,必须与搜索指定的字段一致,否则无法高亮
- 如果要对非搜索字段高亮,则需要添加一个属性:required_field_match=false
示例:
GET /hotel/_search
{
"query": {
"match": {
"all": "如家"
}
},
"highlight": {
"fields": {
"name": {
"require_field_match": "false"
}
}
}
}
总结
查询的DSL是一个大的JSON对象,包含下列属性:
- query:查询条件
- from和size:分页条件
- sort:排序条件
- highlight:高亮条件
示例:
数据聚合
聚合(aggregations)可以让我们极其方便的实现对数据的统计、分析、运算。例如:
- 什么品牌的手机最受欢迎?
- 这些手机的平均价格、最高价格、最低价格?
- 这些手机每月的销售情况如何?
实现这些统计功能的比数据库的sql要方便的多,而且查询速度非常快,可以实现近实时搜索效果。
聚合的种类
聚合常见的有三类:
- **桶(Bucket)**聚合:用来对文档做分组
- TermAggregation:按照文档字段值分组,例如按照品牌值分组、按照国家分组
- Date Histogram:按照日期阶梯分组,例如一周为一组,或者一月为一组
- **度量(Metric)**聚合:用以计算一些值,比如:最大值、最小值、平均值等
- Avg:求平均值
- Max:求最大值
- Min:求最小值
- Stats:同时求max、min、avg、sum等
- **管道(pipeline)**聚合:其它聚合的结果为基础做聚合
**注意:**参加聚合的字段必须是keyword、日期、数值、布尔类型
DSL实现聚合
现在,我们要统计所有数据中的酒店品牌有几种,其实就是按照品牌对数据分组。此时可以根据酒店品牌的名称做聚合,也就是Bucket聚合。
Bucket聚合语法
语法如下:
GET /hotel/_search
{
"size": 0, // 设置size为0,结果中不包含文档,只包含聚合结果
"aggs": { // 定义聚合
"brandAgg": { //给聚合起个名字
"terms": { // 聚合的类型,按照品牌值聚合,所以选择term
"field": "brand", // 参与聚合的字段
"size": 20 // 希望获取的聚合结果数量
}
}
}
}
结果如图:
聚合结果排序
默认情况下,Bucket聚合会统计Bucket内的文档数量,记为_count,并且按照_count降序排序。
我们可以指定order属性,自定义聚合的排序方式:
GET /hotel/_search
{
"size": 0,
"aggs": {
"brandAgg": {
"terms": {
"field": "brand",
"order": {
"_count": "asc" // 按照_count升序排列
},
"size": 20
}
}
}
}
限定聚合范围
默认情况下,Bucket聚合是对索引库的所有文档做聚合,但真实场景下,用户会输入搜索条件,因此聚合必须是对搜索结果聚合。那么聚合必须添加限定条件。
我们可以限定要聚合的文档范围,只要添加query条件即可:
GET /hotel/_search
{
"query": {
"range": {
"price": {
"lte": 200 // 只对200元以下的文档聚合
}
}
},
"size": 0,
"aggs": {
"brandAgg": {
"terms": {
"field": "brand",
"size": 20
}
}
}
}
这次,聚合得到的品牌明显变少了:
Metric聚合语法
上节课,我们对酒店按照品牌分组,形成了一个个桶。现在我们需要对桶内的酒店做运算,获取每个品牌的用户评分的min、max、avg等值。
这就要用到Metric聚合了,例如stat聚合:就可以获取min、max、avg等结果。
语法如下:
GET /hotel/_search
{
"size": 0,
"aggs": {
"brandAgg": {
"terms": {
"field": "brand",
"size": 20
},
"aggs": { // 是brands聚合的子聚合,也就是分组后对每组分别计算
"score_stats": { // 聚合名称
"stats": { // 聚合类型,这里stats可以计算min、max、avg等
"field": "score" // 聚合字段,这里是score
}
}
}
}
}
}
这次的score_stats聚合是在brandAgg的聚合内部嵌套的子聚合。因为我们需要在每个桶分别计算。
另外,我们还可以给聚合结果做个排序,例如按照每个桶的酒店平均分做排序:
小结
aggs代表聚合,与query同级,此时query的作用是?
- 限定聚合的的文档范围
聚合必须的三要素:
- 聚合名称
- 聚合类型
- 聚合字段
聚合可配置属性有:
- size:指定聚合结果数量
- order:指定聚合结果排序方式
- field:指定聚合字段