【发布时间】:2016-01-12 23:28:56
【问题描述】:
如果使用“fields []”指定,结果中似乎忽略了 geo_point 字段
我有以下索引 test01 的映射
{
"test01": {
"mappings": {
"activity": {
"properties": {
"location": {
"type": "string"
},
"mygeo": {
"type": "geo_point",
"doc_values": true,
"fielddata": {
"format": "compressed",
"precision": "1km"
}
}
}
}
}
}
}
索引包含单个活动
{
"mygeo": {
"lat": 51.247607909,
"lon": 22.565701278
},
"location" : "New York"
}
查询
GET /test01/_search
{
"size" : 1,
"fields": ["location", "mygeo"]
}
在缺少 mygeo 字段的地方生成以下内容。 (我也尝试过“字段”:[“location”,“mygeo.lat”,“mygeo.lon”,“mygeo”])。
"hits": [
{
"_index": "test01",
"_type": "activity",
"_id": "1",
"_score": 1,
"fields": {
"location": [
"New York"
]
}
}
]
获取 mygeo 对象的唯一方法是通过 _source 添加 "_source" : {"includes" : [ "mygeo" ]}。
有没有办法使用“field”参数获取geo_point字段?
我已经尝试过 Rest API 和 Java API。两者都使用 Elasticsearch v. 1.7.1 产生相同的结果。
谢谢
【问题讨论】:
标签: elasticsearch field geopoints