GET _search
{
"query": {
"match_all": {}
}
}
PUT /blog/article/1
{
"title":"my sense",
"author":"syj",
"content":"sense is a good tool"
}
DELETE /blog/arcticle/1
GET /blog/article/1
GET /blog/article/_search
{
"query":{
"query_string": {
"query": "sense"
}
}
}
GET /blog/article/_search
{
"query":{
"query_string": {
"fields": ["id"],
"query": 1
}
}
}
DELETE /attractions
PUT /attractions
{
"mappings": {
"city":{
"properties":{
"city":{"type":"string"},
"state":{"type":"string"},
"location":{"type":"geo_point"}
}
}
}
}
GET /attractions/_search
POST /attractions/city/1
{
"city":"Beijing",
"state":"BJ",
"location":{
"lat":"39.91667",
"lon":"116.41667"
}
}
POST /attractions/city/2
{
"city":"ShangHai",
"state":"SH",
"location":{
"lat":"34.50000",
"lon":"121.43333"
}
}
POST /attractions/city/3
{
"city":"XiaMen",
"state":"XM",
"location":{
"lat":"24.08333",
"lon":"118.10000"
}
}
POST /attractions/city/4
{
"city":"FuZhou",
"state":"FZ",
"location":{
"lat":"26.08333",
"lon":"119.30000"
}
}
POST /attractions/city/5
{
"city":"GuangZhou",
"state":"GZ",
"location":{
"lat":"23.16667",
"lon":"113.23333"
}
}
GET /attractions/city/_search
GET /attractions/city/_search
{
"query": {
"bool": {
"must":{
"match_all": {}
},
"filter":{
"geo_distance": {
"distance": "500km",
"location": {
"lat": 24.46667,
"lon": 118.10000
}
}
}
}
}
}
GET /attractions/city/_search
{
"query": {
"geo_distance": {
"distance": "500km",
"location": {
"lat": 24.46667,
"lon": 118.10000
}
}
}
}
GET /attractions/city/_search
{
"query": {
"bool": {
"must":{
"match_all": {}
},
"filter":{
"geo_bounding_box": {
"location": {
"top_left": {
"lat": 39.91667,
"lon": 116.41667
},
"bottom_right": {
"lat": 24.46667,
"lon": 118.10000
}
}
}
}
}
}
}
GET /attractions/city/_search
{
"query": {
"bool": {
"must":{
"match_all": {}
},
"filter":{
"geo_distance_range": {
"from": "100km",
"to": "200km",
"location": {
"lat": 40.46667,
"lon": -73.809
}
}
}
}
}
}
GET /attractions/city/_search
{
"from": 0,
"size": 1,
"sort": [
{
"_geo_distance": {
"location": {
"lat": 39.91667,
"lon": 116.41167
},
"order": "asc",
"unit": "km"
}
}
],
"query": {
"bool": {
"must":{
"match_all": {}
}
}
}
}
GET /attractions/city/_search
{
"query": {
"bool": {
"must":{
"match_all": {}
},
"filter":{
"geo_distance": {
"distance": "500km",
"location": {
"lat": 24.46667,
"lon": 118.10000
}
}
}
}
},
"aggs": {
"per_ring": {
"geo_distance": {
"field": "location",
"unit": "km",
"origin": {
"lat": 24.46667,
"lon": 118.10000
},
"ranges":[
{"from": 0,"to": 500},
{"from": 500,"to": 8000}
]
}
}
}
}
GET /attractions/city/_search
{
"query": {
"bool": {
"must":{
"match_all": {}
},
"filter":{
"geo_distance": {
"distance": "10000km",
"location": {
"lat": 24.46667,
"lon": 118.10000
}
}
}
}
},
"aggs": {
"grid_agg": {
"geohash_grid": {
"field": "location",
"precision": 2
}
}
}
}
GET /attractions/city/_search
{
"query": {
"bool": {
"must":{
"match_all": {}
},
"filter":{
"geo_distance": {
"distance": "10000km",
"location": {
"lat": 24.46667,
"lon": 118.10000
}
}
}
}
},
"aggs": {
"map-zoom": {
"geo_bounds": {
"field": "location"
}
}
}
}
{
"query": {
"match_all": {}
}
}
PUT /blog/article/1
{
"title":"my sense",
"author":"syj",
"content":"sense is a good tool"
}
DELETE /blog/arcticle/1
GET /blog/article/1
GET /blog/article/_search
{
"query":{
"query_string": {
"query": "sense"
}
}
}
GET /blog/article/_search
{
"query":{
"query_string": {
"fields": ["id"],
"query": 1
}
}
}
DELETE /attractions
PUT /attractions
{
"mappings": {
"city":{
"properties":{
"city":{"type":"string"},
"state":{"type":"string"},
"location":{"type":"geo_point"}
}
}
}
}
GET /attractions/_search
POST /attractions/city/1
{
"city":"Beijing",
"state":"BJ",
"location":{
"lat":"39.91667",
"lon":"116.41667"
}
}
POST /attractions/city/2
{
"city":"ShangHai",
"state":"SH",
"location":{
"lat":"34.50000",
"lon":"121.43333"
}
}
POST /attractions/city/3
{
"city":"XiaMen",
"state":"XM",
"location":{
"lat":"24.08333",
"lon":"118.10000"
}
}
POST /attractions/city/4
{
"city":"FuZhou",
"state":"FZ",
"location":{
"lat":"26.08333",
"lon":"119.30000"
}
}
POST /attractions/city/5
{
"city":"GuangZhou",
"state":"GZ",
"location":{
"lat":"23.16667",
"lon":"113.23333"
}
}
GET /attractions/city/_search
GET /attractions/city/_search
{
"query": {
"bool": {
"must":{
"match_all": {}
},
"filter":{
"geo_distance": {
"distance": "500km",
"location": {
"lat": 24.46667,
"lon": 118.10000
}
}
}
}
}
}
GET /attractions/city/_search
{
"query": {
"geo_distance": {
"distance": "500km",
"location": {
"lat": 24.46667,
"lon": 118.10000
}
}
}
}
GET /attractions/city/_search
{
"query": {
"bool": {
"must":{
"match_all": {}
},
"filter":{
"geo_bounding_box": {
"location": {
"top_left": {
"lat": 39.91667,
"lon": 116.41667
},
"bottom_right": {
"lat": 24.46667,
"lon": 118.10000
}
}
}
}
}
}
}
GET /attractions/city/_search
{
"query": {
"bool": {
"must":{
"match_all": {}
},
"filter":{
"geo_distance_range": {
"from": "100km",
"to": "200km",
"location": {
"lat": 40.46667,
"lon": -73.809
}
}
}
}
}
}
GET /attractions/city/_search
{
"from": 0,
"size": 1,
"sort": [
{
"_geo_distance": {
"location": {
"lat": 39.91667,
"lon": 116.41167
},
"order": "asc",
"unit": "km"
}
}
],
"query": {
"bool": {
"must":{
"match_all": {}
}
}
}
}
GET /attractions/city/_search
{
"query": {
"bool": {
"must":{
"match_all": {}
},
"filter":{
"geo_distance": {
"distance": "500km",
"location": {
"lat": 24.46667,
"lon": 118.10000
}
}
}
}
},
"aggs": {
"per_ring": {
"geo_distance": {
"field": "location",
"unit": "km",
"origin": {
"lat": 24.46667,
"lon": 118.10000
},
"ranges":[
{"from": 0,"to": 500},
{"from": 500,"to": 8000}
]
}
}
}
}
GET /attractions/city/_search
{
"query": {
"bool": {
"must":{
"match_all": {}
},
"filter":{
"geo_distance": {
"distance": "10000km",
"location": {
"lat": 24.46667,
"lon": 118.10000
}
}
}
}
},
"aggs": {
"grid_agg": {
"geohash_grid": {
"field": "location",
"precision": 2
}
}
}
}
GET /attractions/city/_search
{
"query": {
"bool": {
"must":{
"match_all": {}
},
"filter":{
"geo_distance": {
"distance": "10000km",
"location": {
"lat": 24.46667,
"lon": 118.10000
}
}
}
}
},
"aggs": {
"map-zoom": {
"geo_bounds": {
"field": "location"
}
}
}
}