Does AWS ElasticSearch v7.1 supports script_fields in queries?

Hello,
To return the distance information for each document and the query search origin, I'm using the following snippet:
"script_fields": {
"distance": {
"script": "doc['location_lat_lon'].arcDistance(40,-105)"
}
}

Does AWS ElasticSearch accept this kind of script field? If not, how can I modify this code to return the distance of each doc to the query search origin?

Best,

Why not using sort by distance ?
The sort key which is returned in the response object is the distance.

BTW did you look at https://www.elastic.co/cloud and https://aws.amazon.com/marketplace/pp/B01N6YCISK ?

Cloud by elastic is one way to have access to all features, all managed by us. Think about what is there yet like Security, Monitoring, Reporting, SQL, Canvas, APM, Logs UI, Infra UI, SIEM, Maps UI, AppSearch and what is coming next :slight_smile: ...

Thanks for your reply. Yeah, I can sort by distance and have that value in the response. However, if the order of sort keys are different then order of those values in the response is also different. Need to keep a mapping for it at the query time (it's doable), but this way was always robust no matter if we sort by distance or not, we always get a key-value for it in the response (easy to parse).

The reason is our other services are in AWS. However, sure, we'll think about it more ;).

Best,

I mentioned using the sort feature as it will be faster in my opinion than a painless script.

That's why our service runs also on AWS so you are always close to your application :wink:

1 Like

This is very useful to me. So, you're saying we can purchase the service from ES, have all the features, but still host it in AWS?
So, if we get it from this link, we have both benefits?

Thanks,

Exact. If you go directly to cloud.elastic.co you can have a 14 days free trial without any credit card to test it.
Don't use the marketplace link as it won't be free using this link.

1 Like

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