karmi/tire — Issue #244: Implement script_fields
Author: yeggeps
Created: 2012-02-16 11:12:10+00:00
State: open

Would it be possible to implement script_fields and fields? If so, where would they best be implemented?

I'm looking to mix something like this in mostly all my queries:

```
curl -XGET 'http://127.0.0.1:9200/geonames/_search?pretty=1' -d '
{
"script_fields" : {
"distance" : {
"params" : {
"lat" : 2.27,
"lon" : 50.3
},
"script" : "doc[location].distanceInKm(lat,lon)"
}
}
}
'

# [Thu Feb 16 11:20:29 2012] Response:
# {
# "hits" : {
# "hits" : [
# {
# "_score" : 1,
# "fields" : {
# "distance" : 466.844095463887
# },
# "_index" : "geonames_1318324623",
# "_id" : "6436641_en",
# "_type" : "place"
# },
```