Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
Describe the issue:
distance_feature naively only works for one location per organization!
My field is location.position, where there is a list of locations for each organization (location is an element of organization like organization.location.position)
Since location is really a list, distance_feature is really searching location[-1].position, whichever location happens to be stored last in the organization index.
Since the distance varies with each user position, we cannot know the right ordering at index time, so we cannot store them in order.
How do I do a search on location[minimum distance].position ??
I would use a painless script, but you cannot reference the script fields in another script nor in the actual OS query execution!
I would use a runtime_mapping/field, but Elasticsearch has that feature and you do NOT!!
What can I use?
Relevant Logs or Screenshots: