0

Is there a way to dynamically append a driving distance of the CONSUMER in ES?

I am trying to create an app and sort PROVIDERS by driving distance.

One thing I could think of is get all the PROVIDERS within a range then put them in an array. Iterate to add driving distance then sort array. But this is not efficient.

Any suggestions?

thank you!

dr.calix
  • 667
  • 8
  • 21
  • can you plese add some sample document, sample query which you have tried and sample response you are expecting ? – Sagar Patel May 05 '22 at 04:08

1 Answers1

0

You can use runtime fields to achieve what you want, A runtime field is a field that is evaluated at query time. Runtime fields enable you to:

  • Add fields to existing documents without reindexing your data Start

  • working with your data without understanding how it’s structured

  • Override the value returned from an indexed field at query time

  • Define fields for a specific use without modifying the underlying
    schema

For more information you can check Elasticsearch blog post here, and for runtime fields here.

Kaveh
  • 1,158
  • 6
  • 16