I have data stored with a nested location object and can't figure out how to get elastic4s to return the location as part of the result of a search. I have data that when queried (from the REST endpoint) looks like this:
{
"_index": "us_large_cities",
"_type": "city",
"_id": "AU7ke-xU_N_KRYZ5Iii_",
"_score": 1,
"_source": {
"city": "Oakland",
"state": "CA",
"location": {
"lat": "37.8043722",
"lon": "-122.2708026"
}
}
}
When I try querying it using elastic4s like so:
search in "us_large_cities"->"city" fields("location", "city", ) query {
filteredQuery filter {
geoPolygon("location") point(37.9, -122.31) point(37.8, -122.31) point(37.8, -122.25) point(37.9, -122.25)
}
I get back results like this:
{
"_index" : "us_large_cities",
"_type" : "city",
"_id" : "AU7keH9l_N_KRYZ5Iig0",
"_score" : 1.0,
"fields" : {
"city" : [ "Berkeley" ]
}
}
Where I would expect to see "location" but don't. Does anyone know how I specify the fields so that I can actually get the location?