It seems that geo_point fields are ignored in the result if specified using "fields []"
I have the following mapping for index test01
{
"test01": {
"mappings": {
"activity": {
"properties": {
"location": {
"type": "string"
},
"mygeo": {
"type": "geo_point",
"doc_values": true,
"fielddata": {
"format": "compressed",
"precision": "1km"
}
}
}
}
}
}
}
The index contains a single activity
{
"mygeo": {
"lat": 51.247607909,
"lon": 22.565701278
},
"location" : "New York"
}
Query
GET /test01/_search
{
"size" : 1,
"fields": ["location", "mygeo"]
}
generates the following where the mygeo field is missing. (I have also tried "fields": ["location", "mygeo.lat", "mygeo.lon", "mygeo"]).
"hits": [
{
"_index": "test01",
"_type": "activity",
"_id": "1",
"_score": 1,
"fields": {
"location": [
"New York"
]
}
}
]
The only way I can get the mygeo object is through _source by adding "_source" : {"includes" : [ "mygeo" ]}.
Is there any way to get a geo_point field using the "field" parameter?
I have tried the Rest API and the Java API. Both produce the same result using Elasticsearch v. 1.7.1.
Thanks