Object property not showing up in index (unable to access in the doc variable in a script)

Hello,

I have a property of type object within a mapping definition but when i
attempt to access it within a script, it is not available in the doc
variable. it is in _source... what do i need to specify in order to always
have the property of type object appear in the index?

this is the sub object mapping ... I tried adding type:'object',
enable:true, include_in_all:true..... my objective is to compute the
distance of the nearest location, so my script is enumerating through the
locations and computing distance for each geo point....

....
"location":{
"properties":{
"facility":{
"properties":{
"name":{"type":"string",
index:"not_analyzed"},
"address":{
"properties":{
"city":{"type":"string",
index:"not_analyzed"},
"state":{"type":"string",
index:"not_analyzed"},
"zip":{"type":"string",
index:"not_analyzed"},
"country":{"type":"string",
index:"not_analyzed"}
}
},
"geo":{
"type":"geo_point"
}
}
}
}
},

{"query":{
"custom_score":{
"query":{
"match_all":{}
},
"script":"_score + doc['mboost'].value"
}
}, "filter":{

"query":{
    "match_phrase":{
        "status":"Recruiting"
    }
}

}, "fields":"_source",
"script_fields":{
"distance":{
"params":{
"lat":42.3788774,
"lon":-72.032366
},
"script": "c=doc[\u0027location\u0027].empty ? null :
doc[\u0027location\u0027]; nearest_distance=java.lang.Double.MAX_VALUE;
if(c!=null){for(cur : c) {if(cur["facility"]!=null &&
cur["facility"]["geo"]!=null){dist=cur["facility"]["geo"].distance(lat,
lon); if(dist < nearest_distance){ nearest_distance = dist}}}};
nearest_distance"
}
},
"sort":{
"_score":"desc"
}, "from":"0", "size":"10"
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.