# SOLR to Elastic NEWEST

**URL:** <https://discuss.elastic.co/t/solr-to-elastic-newest/82818>\
**Category:** Elasticsearch\
**Created:** [April 19, 2017, 5:20am UTC](https://discuss.elastic.co/t/solr-to-elastic-newest/82818 "2017-04-19T05:20:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![billnbell](https://avatars.discourse-cdn.com/v4/letter/b/eb8c5e/32.png) [@billnbell](https://discuss.elastic.co/u/billnbell)\
**Post date:** [April 19, 2017, 5:20am UTC](https://discuss.elastic.co/t/solr-to-elastic-newest/82818/1 "2017-04-19T05:20:26Z")

</div>

Solr to Elastic.

How do I covert:

{!boost b=recip(ms(NOW/HOUR,%s),3.16e-11,%s,%s)}

Which is to sort by NEWEST - want to change this to work on Elastic?

---

<div class="post-metadata">

**Author:** ![billnbell](https://avatars.discourse-cdn.com/v4/letter/b/eb8c5e/32.png) [@billnbell](https://discuss.elastic.co/u/billnbell)\
**Post date:** [April 20, 2017, 4:12pm UTC](https://discuss.elastic.co/t/solr-to-elastic-newest/82818/2 "2017-04-20T16:12:01Z")

</div>

Not sure how to do a dynamic ms(NOW/HOUR) and have low values for 10 years ago, and higher values for times closer to now.

Something like the following with exponentialDecayFunction might work, but the math is making it hard to debug.

filterFunctionBuilders.add(  
new FunctionScoreQueryBuilder.FilterFunctionBuilder(ScoreFunctionBuilders.exponentialDecayFunction(elasticField, new Date().getTime(), scale, 0, .1).setWeight(boost))  
);

---

<div class="post-metadata">

**Author:** ![billnbell](https://avatars.discourse-cdn.com/v4/letter/b/eb8c5e/32.png) [@billnbell](https://discuss.elastic.co/u/billnbell)\
**Post date:** [April 27, 2017, 6:10pm UTC](https://discuss.elastic.co/t/solr-to-elastic-newest/82818/3 "2017-04-27T18:10:37Z")

</div>

bump ?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 25, 2017, 6:15pm UTC](https://discuss.elastic.co/t/solr-to-elastic-newest/82818/4 "2017-05-25T18:15:38Z")

</div>

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