I'm trying to implement function_score query to blend full-text query with geo location--similar to what's described here: https://www.elastic.co/guide/en/elasticsearch/guide/current/decay-functions.html. however my documents' geo_location is in a locations array (locations.geo_location) which has a nested mapping. here's some "sense" which demonstrates the problem:
POST my_index
{
  "settings": {"number_of_shards": 1},
  "mappings": {
     "person": {
        "properties": {
           "name": {"type": "string"},
           "locations": {
              "type": "nested",
              "properties": {
                 "city": {"type": "string"},
                 "geo_location": {"type": "geo_point"},
                 "state": {"type": "string"}
              }
           }
        }
     }
  }
}
PUT my_index/person/1
{
  "name": "john doe",
  "locations": [
      {"city": "foo", "state": "bar", "geo_location": [-87, 41]}
    ]
}
PUT my_index/person/2
{
  "name": "jane doe",
  "locations": [
      {"city": "foo", "state": "bar", "geo_location": [-88, 42]}
    ]
}
GET my_index/_search
{
  "query": {
    "function_score": {
      "query": {
        "match": {
          "name": "doe"
        }
      },
      "functions": [
        {"gauss": {
          "locations.geo_location": {
            "origin": { "lat": 42, "lon": -88 },
            "scale": "100km"
          }
        }}
      ]
    }
  }
}
{
    "took": 2,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "failed": 0
    },
    "hits": {
        "total": 2,
        "max_score": 0.8048013,
        "hits": [
            {
                "_index": "my_index",
                "_type": "person",
                "_id": "1",
                "_score": 0.8048013,
                "_source": {
                    "name": "john doe",
                    "locations": [
                        {
                            "city": "foo",
                            "state": "bar",
                            "geo_location": [
                                -87,
                                41
                            ]
                        }
                    ]
                }
            },
            {
                "_index": "my_index",
                "_type": "person",
                "_id": "2",
                "_score": 0.8048013,
                "_source": {
                    "name": "jane doe",
                    "locations": [
                        {
                            "city": "foo",
                            "state": "bar",
                            "geo_location": [
                                -88,
                                42
                            ]
                        }
                    ]
                }
            }
        ]
    }
}
The score is same for both results though I was hoping doc #2 would be ranked higher. So it appears the nested mapping is causing problems with the above query. FWIW after dropping the ("type": "nested") from the locations mapping results are returned as expected. Is it possible to wrap the gauss locations.geo_location function in a nested wrapper, and what would that look like? Thanks for your time and consideration!