This is an ES-hadoop question.
Query looks like this.
{
"query": {
"filtered": {
"query": {
"term": {
"coname.raw": {
"value": "abc inc"
}
}
},
"filter": {
"bool": {
"must": [
{
"term": {
"city.raw": "fort myers"
}
},
{
"term": {
"zip": "12345"
}
},
{
"query": {
"match": {
"street": {
"query": "1234 xyz st",
"minimum_should_match": "75%"
}
}
}
}
],
"should": [
{
"geo_distance": {
"distance": 500,
"distance_unit": "m",
"point": {
"lat": 12.34,
"lon": -56.78
}
}
}
]
}
}
}
},
"fields": [
"_source"
],
"script_fields": {
"distance": {
"params": {
"lat": 12.34,
"lon": -56.78
},
"script": "doc['point'].distance(lat,lon)"
}
}
}
In the Sense, I get the result back like this.
{
"took": 9,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 16.71316,
"hits": [
{
"_index": "myindex",
"_type": "businesses",
"_id": "AVHLPmOawjmarqgxrsIp",
"_score": 16.71316,
"_source": {
"locnum": "871121299",
"coname": "abc inc",
"street": "xyz st",
"city": "fort myers",
"state": "fl",
"state_name": "florida",
"zip": "12345",
},
"fields": {
"distance": [
109.94139695812709
]
}
}
]
}
}
In SCRIPT_FIELDS, I specified the distance and I got it no problem using Sense.
When I run this query thru sc.esRDD(), I don't receive distance -> 109.94139695812709.
So, the question is, how do I tell sc.esRDD() to include distance -> 109.94139695812709 in the returned RDD?
Hope this helps.
Thanks,
Q