索引创建
location: {
lat: 31.221308725705452
lon: 121.46336800986947
}
索引mapping
{
"location" : {
"type" : "geo_point"
}
}
排序搜索
查询json:
{
"sort": [
{
"_geo_distance": {
"unit": "km",
"order": "asc",
"location": [
121.46336800986947,
31.221308725705452
],
"distance_type": "sloppy_arc",
"mode": "min"
}
}
],
"from": 0,
"size": 10,
"query": {
"filtered": {
"query": {
"bool": {
"must": {
"match_all": {}
}
}
},
"filter": {
"bool": {
"must": [
{
"term": {
"channelCodes.channelCode": [
"WWW"
]
}
}
]
}
}
}
}
}
范围查询
文档:
https://www.elastic.co/blog/ge ... earch
https://www.elastic.co/guide/e ... .html