78 ElasticSearch 酒店o2o搜索案例以及搜索指定区域内的酒店
78 ElasticSearch 酒店o2o搜索案例以及搜索指定区域内的酒店
酒店o2o搜索案例以及搜索指定区域内的酒店
- 分布式实战(干货)
- spring cloud 实战(干货)
- mybatis 实战(干货)
- spring boot 实战(干货)
- React 入门实战(干货)
- 构建中小型互联网企业架构(干货)
- python 学习持续更新
- ElasticSearch 笔记
概述
稍微真实点的案例,酒店o2o app作为一个背景,用各种各样的方式,去搜索你当前所在的地理位置附近的酒店
搜索指定区域范围内的酒店,比如说,我们可以在搜索的时候,指定两个地点,就要在东方明珠大厦和上海路组成的矩阵的范围内,搜索我想要的酒店
PUT /hotel_app
{"mappings": {"hotels": {"properties": {"pin": {"properties": {"location": {"type": "geo_point"}}}}}}
}
PUT /hotel_app/hotels/1
{"name": "喜来登大酒店","pin" : {"location" : {"lat" : 40.12,"lon" : -71.34}}
}
GET /hotel_app/hotels/_search
{"query": {"bool": {"must": [{"match_all": {}}],"filter": {"geo_bounding_box": {"pin.location": {"top_left" : {"lat" : 40.73,"lon" : -74.1},"bottom_right" : {"lat" : 40.01,"lon" : -71.12}}}}}}
}
GET /hotel_app/hotels/_search
{"query": {"bool": {"must": [{"match_all": {}}],"filter": {"geo_polygon": {"pin.location": {"points": [{"lat" : 40.73, "lon" : -74.1},{"lat" : 40.01, "lon" : -71.12},{"lat" : 50.56, "lon" : -90.58}]}}}}}
}
我们现在要指定东方明珠大厦,上海路,上海博物馆,这三个地区组成的多边形的范围内,我要搜索这里面的酒店
最新文章
- 性能测试案例
- digest介绍
- springboot项目搭建0050
- 自定义注解实现RBAC权限校验,不要再说你不会了
- cocosbuilder创建工程
- python中的platform模块获取平台信息
- 简略写dump文件
- 黑客快速入门
- 软件质量有什么特性?
- Maven的三种packaging方式(pom、jar、war)
- mmap例子详解
- 详解mmap:是什么 为什么 怎么用
- python,jsonschema, marshmallow, “None is not of type ‘string‘
- nofollow标签使用方法
- TCPIP协议——TCP协议
- 第三方联调
- schedulewithfixeddelay