当我尝试使用Angular 4调用弹性搜索API时,我遇到此错误,无法使用弹性座垫和角度4来找到geo_point字段[pin.location]错误
我的Angular代码 fullTextSearch(_index,_type,_field,_queryText):任意{
return this.client.search({
index: _index,
body: {
"query": {
"bool" : {
"must" : {
"match_all" : {}
},
"filter" : {
"geo_distance" : {
"distance" : "150km",
"location" : {
"lat" : -70.34,
"lon" : 40.12
}
}
}
}
}
}
});
}
我的elasticsearch _search API数据
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 1,
"hits": [
{
"_index": "dev_ll_user",
"_type": "user",
"_id": "2243534dfsgdfg56456gy54675",
"_score": 1,
"_source": {
"location": {
"lat": 40.12,
"lon": -71.34
}
}
},
{
"_index": "dev_ll_user",
"_type": "user",
"_id": "12f7b1c5-2f2d-4841-a8ba-9bc46de3f73f",
"_score": 1,
"_source": {
"location": {
"lat": 40.12,
"lon": -71.34
}
}
}
]
}
}
我收到此错误
{"error":{"root_cause":[{"type":"query_shard_exception","reason":"failed to find geo_point field [location]","index_uuid":"vwW0z7FLT7-nMOMl0-P5Hw","index":"dev_ll_user"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"dev_ll_user","node":"G2sZhDbgQ02V1hay3rzoWg","reason":{"type":"query_shard_exception","reason":"failed to find geo_point field [location]","index_uuid":"vwW0z7FLT7-nMOMl0-P5Hw","index":"dev_ll_user"}}]},"status":400}