We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PUT /my_locations
{ "mappings": { "properties": { "shop_location": { "type": "nested", "properties": { "location": {"type":"geo_point"}, "name": {"type": "keyword"} } } } } }
PUT /my_locations/_doc/2 { "shop_location": [ { "location": {"lat": 30.292755,"lon": 120.016573}, "name": "杭师大" }, { "location": {"lat": 30.283565, "lon": 119.992541}, "name": "绿苑" }, { "location":{"lat": 30.289494, "lon": 119.988249}, "name": "梦想小镇" } ] } //1 PUT /my_locations/_doc/1 { "shop_location": [ { "location": {"lat": 30.128427,"lon": 120.211254}, "name": "湘湖" }, { "location": {"lat": 30.226221, "lon": 120.143276}, "name": "太子湾" }, { "location":{"lat": 30.239569, "lon": 120.125595}, "name": "茅家埠" } ] } //3 PUT /my_locations/_doc/3 { "shop_location": [ { "location": {"lat": 30.217469,"lon": 120.11787}, "name": "杨梅岭" }, { "location": {"lat": 30.22674, "lon": 120.096326}, "name": "法喜寺" }, { "location":{"lat": 30.2607, "lon": 120.091434}, "name": "汽车西站" } ] } //4 PUT /my_locations/_doc/4 { "shop_location": [ { "location": { "lat": 30.319431, "lon": 120.036314 }, "name": "云谷国际" }, { "location":{ "lat": 30.291717, "lon": 120.212954 }, "name": "火车东站" } ] }
GET /my_locations/_search { "query": { "nested": { "path": "shop_location", "query": { "bool": { "must": { "match_all": {} }, "filter": { "geo_distance": { "distance": "12km", "shop_location.location": { "lat": 30.289494, "lon": 119.988249 } } } } } } }, "sort": [ { "_geo_distance": { "shop_location.location": { "lat": 30.289494, "lon": 119.988249 }, "nested":{ "path": "shop_location" }, "order": "asc", "distance_type":"plane", "mode": "min" } } ] }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
创建mapping
添加 数据
搜索
The text was updated successfully, but these errors were encountered: