Search code examples
elasticsearchranking

ElasticSearch: rank by proximity to date


In ElasticSearch, is there a way to rank search results by proximity to a given date (or number)?


Solution

  • You can use Script Based Sorting to do calculate the proximity. However, if you have a large number of results, your might need to switch to native script to achieve good performance.