不添加条件查询出来数据:
POST http://localhost:9200/show/test/_search
{
"took": 5,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 4,
"max_score": 1,
"hits": [
{
"_index": "show",
"_type": "test",
"_id": "SzrntWoBFL5R1ZtAHrkc",
"_score": 1,
"_source": {
"id": 3,
"username": "农家商装",
"description": "现在想要修改为string类型",
"position": {
"location": {
"lat": 22.6515108793,
"lon": 114.1106377105
}
}
}
}
]
}
}
第二次查询
POST http://localhost:9200/show/test/_search
{
"query": {
"bool": {
"filter": {
"geo_distance": "100km",
"location": {
"lat": 22.6497899384,
"lon": 114.1258725301
}
}
}
}
}
报错:
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "[geo_distance] query malformed, no start_object after query name",
"line": 5,
"col": 21
}
],
"type": "parsing_exception",
"reason": "[geo_distance] query malformed, no start_object after query name",
"line": 5,
"col": 21
},
"status": 400
}