# Retrieving query\_score while using "replace" in the function\_score query

**URL:** https://discuss.elastic.co/t/retrieving-query-score-while-using-replace-in-the-function-score-query/130034
**Category:** Elasticsearch
**Created:** [April 30, 2018, 2:17pm UTC](https://discuss.elastic.co/t/retrieving-query-score-while-using-replace-in-the-function-score-query/130034 "2018-04-30T14:17:00Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![xan\_ps](https://avatars.discourse-cdn.com/v4/letter/x/c89c15/32.png) [@xan\_ps](https://discuss.elastic.co/u/xan_ps)
#### Post date: [April 30, 2018, 2:17pm UTC](https://discuss.elastic.co/t/retrieving-query-score-while-using-replace-in-the-function-score-query/130034/1 "2018-04-30T14:17:00Z")

</div>

Using "replace" in the Elasticsearch function score discards the query\_score altogether.  
"only function score is used, the query score is ignored".

In my requirement, I do want the "replace" as I'm sorting based ONLY on the function\_score.  
But, later on I do require the query\_score as well.

Hence, I wanted to know if there is way to retrieve the query\_score while using "replace" in my function\_score query.

---

<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 28, 2018, 2:17pm UTC](https://discuss.elastic.co/t/retrieving-query-score-while-using-replace-in-the-function-score-query/130034/2 "2018-05-28T14:17:14Z")

</div>

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