Skip to content
This repository has been archived by the owner on Jun 30, 2018. It is now read-only.

Implement script_fields #244

Closed
mattiassvedhem opened this issue Feb 16, 2012 · 1 comment
Closed

Implement script_fields #244

mattiassvedhem opened this issue Feb 16, 2012 · 1 comment

Comments

@mattiassvedhem
Copy link
Contributor

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

Script fields

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"
#          },
@karmi
Copy link
Owner

karmi commented Feb 16, 2012

Yeah, I guess it's on the same level as the field method, https://github.com/karmi/tire/blob/master/lib/tire/search.rb#L75-78

martinciu added a commit to martinciu/tire that referenced this issue Jun 3, 2012
martinciu added a commit to martinciu/tire that referenced this issue Jun 3, 2012
@martinciu martinciu mentioned this issue Jun 3, 2012
@karmi karmi closed this as completed in c6819d2 Jun 8, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants