網(wǎng)站首頁 編程語言 正文
一 創(chuàng)建mapping
PUT test
{
"mappings": {
"test":{
"properties": {
"location":{
"type": "geo_point"
}
}
}
}
}
二 導(dǎo)入數(shù)據(jù)
POST test/test
{
"location":{
"lat":12,
"lon":24
}
}
三 查詢
3.1根據(jù)給定兩個點組成的矩形,查詢矩形內(nèi)的點
GET test/test/_search
{
"query": {
"geo_bounding_box": {
"location": {
"top_left": {
"lat": 28,
"lon": 10
},
"bottom_right": {
"lat": 10,
"lon": 30
}
}
}
}
}
3.2根據(jù)給定的多個點組成的多邊形,查詢范圍內(nèi)的點
GET test/test/_search
{
"query": {
"geo_polygon": {
"location": {
"points": [
{
"lat": 11,
"lon": 25
},
{
"lat": 13,
"lon": 25
},
{
"lat": 13,
"lon": 23
},
{
"lat": 11,
"lon": 23
}
]
}
}
}
}
3.3查詢給定1000KM距離范圍內(nèi)的點
GET test/test/_search
{
"query": {
"geo_distance": {
"distance": "1000km",
"location": {
"lat": 12,
"lon": 23
}
}
}
}
3.4查詢距離范圍區(qū)間內(nèi)的點的數(shù)量
GET test/test/_search
{
"size": 0,
"aggs": {
"myaggs": {
"geo_distance": {
"field": "location",
"origin": {
"lat": 52.376,
"lon": 4.894
},
"unit": "km",
"ranges": [
{
"from": 50,
"to": 30000
}
]
}
}
}
}
原文鏈接:https://www.cnblogs.com/guyouyin123/p/13308748.html
相關(guān)推薦
- 2022-07-02 使用numpy.mean()?計算矩陣均值方式_python
- 2022-11-21 go語言算法題解二叉樹的最小深度_Golang
- 2022-02-09 將?C++?類型屬性暴露給?QML_C 語言
- 2022-04-04 運行npm run dev報錯(已解決)
- 2023-01-14 python與matlab一些常用函數(shù)互轉(zhuǎn)問題_python
- 2022-04-30 DataGridView控件常用屬性介紹_C#教程
- 2022-06-10 在vscode中快速新建html文件的2種方法總結(jié)_C 語言
- 2022-07-11 docker搭建redis 主從哨兵集群
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細win安裝深度學習環(huán)境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡單動態(tài)字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支