Getting value out of Script Fields


(Aaron Bauman) #1

I am trying to extract a script field from my response using Elasticsearch Nest.
Here's the working script_fields from my query:

"script_fields": {
    "distance_in_miles": {
      "script": {
        "source": "doc['location'].arcDistance(params.lat,params.lon)",
        "params": {
          "lat": 25,
          "lon": 71
        }
      }
    }
  }

The following C# returns a LazyDocument, populated with a JToken of JArray.

hit.Fields["distance_in_miles"]

How do I turn this into something useful?


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.