# Function\_score

**URL:** <https://discuss.elastic.co/t/function-score/14538>\
**Category:** Elasticsearch\
**Created:** [November 22, 2013, 8:31am UTC](https://discuss.elastic.co/t/function-score/14538 "2013-11-22T08:31:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![paul1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul1/32/46819_2.png) [@paul1](https://discuss.elastic.co/u/paul1)\
**Post date:** [November 22, 2013, 8:31am UTC](https://discuss.elastic.co/t/function-score/14538/1 "2013-11-22T08:31:26Z")

</div>

What should be defined inside the function , any example queries. could not  
find one on elastic search page.this throws a exception No query  
registered for [function\_score]]  
{  
"query":{  
"function\_score":{  
"query":{  
"match":{  
"programs":"computer science"  
}  
},  
"functions":[  
{  
"filter":{  
"range":{  
"tution":{  
"from":10000,  
"to":20000  
}  
}  
},  
"FUNCTION":{  
"boost": "3"  
}  
}  
],  
"score\_mode":"avg",  
"boost\_mode":"avg"  
}  
}  
}

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [November 22, 2013, 8:34am UTC](https://discuss.elastic.co/t/function-score/14538/2 "2013-11-22T08:34:49Z")

</div>

Hey,

you need to use one of the score functions mentioned in

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

So either script\_score, boost factor, random or one of the decay  
functions.. the error message is also telling you not to forget the query  
field inside of the function score.

--Alex

On Fri, Nov 22, 2013 at 9:31 AM, paul [avinashpaul85@gmail.com](mailto:avinashpaul85@gmail.com) wrote:

> What should be defined inside the function , any example queries. could  
> not find one on Elasticsearch page.this throws a exception No query  
> registered for [function\_score]]  
> {  
> "query":{  
> "function\_score":{  
> "query":{  
> "match":{  
> "programs":"computer science"  
> }  
> },  
> "functions":[  
> {  
> "filter":{  
> "range":{  
> "tution":{  
> "from":10000,  
> "to":20000  
> }  
> }  
> },  
> "FUNCTION":{  
> "boost": "3"  
> }  
> }  
> ],  
> "score\_mode":"avg",  
> "boost\_mode":"avg"  
> }  
> }  
> }
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![paul1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul1/32/46819_2.png) [@paul1](https://discuss.elastic.co/u/paul1)\
**Post date:** [November 22, 2013, 9:20am UTC](https://discuss.elastic.co/t/function-score/14538/3 "2013-11-22T09:20:28Z")

</div>

thank you , will try them.

On Fri, Nov 22, 2013 at 2:04 PM, Alexander Reelsen [alr@spinscale.de](mailto:alr@spinscale.de) wrote:

> Hey,
> 
> you need to use one of the score functions mentioned in  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html#_score_functions)
> 
> So either script\_score, boost factor, random or one of the decay  
> functions.. the error message is also telling you not to forget the query  
> field inside of the function score.
> 
> --Alex
> 
> On Fri, Nov 22, 2013 at 9:31 AM, paul [avinashpaul85@gmail.com](mailto:avinashpaul85@gmail.com) wrote:
> 
> > What should be defined inside the function , any example queries. could  
> > not find one on Elasticsearch page.this throws a exception No query  
> > registered for [function\_score]]  
> > {  
> > "query":{  
> > "function\_score":{  
> > "query":{  
> > "match":{  
> > "programs":"computer science"  
> > }  
> > },  
> > "functions":[  
> > {  
> > "filter":{  
> > "range":{  
> > "tution":{  
> > "from":10000,  
> > "to":20000  
> > }  
> > }  
> > },  
> > "FUNCTION":{  
> > "boost": "3"  
> > }  
> > }  
> > ],  
> > "score\_mode":"avg",  
> > "boost\_mode":"avg"  
> > }  
> > }  
> > }
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).
> > 
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/ZGjv6eCBKXs/unsubscribe](https://groups.google.com/d/topic/elasticsearch/ZGjv6eCBKXs/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![paul1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul1/32/46819_2.png) [@paul1](https://discuss.elastic.co/u/paul1)\
**Post date:** [November 22, 2013, 9:37am UTC](https://discuss.elastic.co/t/function-score/14538/4 "2013-11-22T09:37:40Z")

</div>

hi Alex i tried as suggested but it seams i am still missing something ,  
when i tried the query below i still get No query registered for  
[function\_score]] exception

{  
"query": {  
"function\_score": {  
"functions": [  
{  
"DECAY\_FUNCTION": {  
"Tution": {  
"reference": "10000",  
"scale": "5000"  
}  
}  
}  
],  
"query": {  
"match": {  
"programs": "computer science"  
}  
},  
"score\_mode": "multiply"  
}  
}  
}

On Friday, 22 November 2013 14:04:49 UTC+5:30, Alexander Reelsen wrote:

> Hey,
> 
> you need to use one of the score functions mentioned in  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html#_score_functions)[http://www.google.com/url?q=http%3A%2F%2Fwww.elasticsearch.org%2Fguide%2Fen%2Felasticsearch%2Freference%2Fcurrent%2Fquery-dsl-function-score-query.html%23\_score\_functions&sa=D&sntz=1&usg=AFQjCNFBAPkmuOAra99m7KO\_A6OltCBZoQ](http://www.google.com/url?q=http%3A%2F%2Fwww.elasticsearch.org%2Fguide%2Fen%2Felasticsearch%2Freference%2Fcurrent%2Fquery-dsl-function-score-query.html%23_score_functions&sa=D&sntz=1&usg=AFQjCNFBAPkmuOAra99m7KO_A6OltCBZoQ)
> 
> So either script\_score, boost factor, random or one of the decay  
> functions.. the error message is also telling you not to forget the query  
> field inside of the function score.
> 
> --Alex
> 
> On Fri, Nov 22, 2013 at 9:31 AM, paul \<[avinas...@gmail.com](mailto:avinas...@gmail.com) \<javascript:\>\>wrote:
> 
> > What should be defined inside the function , any example queries. could  
> > not find one on Elasticsearch page.this throws a exception No query  
> > registered for [function\_score]]  
> > {  
> > "query":{  
> > "function\_score":{  
> > "query":{  
> > "match":{  
> > "programs":"computer science"  
> > }  
> > },  
> > "functions":[  
> > {  
> > "filter":{  
> > "range":{  
> > "tution":{  
> > "from":10000,  
> > "to":20000  
> > }  
> > }  
> > },  
> > "FUNCTION":{  
> > "boost": "3"  
> > }  
> > }  
> > ],  
> > "score\_mode":"avg",  
> > "boost\_mode":"avg"  
> > }  
> > }  
> > }
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![William\_Goldstein](https://avatars.discourse-cdn.com/v4/letter/w/898d66/32.png) [@William\_Goldstein](https://discuss.elastic.co/u/William_Goldstein)\
**Post date:** [January 13, 2014, 10:53pm UTC](https://discuss.elastic.co/t/function-score/14538/5 "2014-01-13T22:53:20Z")

</div>

Hey I realize this is an old thread, but just in case anyone else has this  
problem, it's almost definitely a versioning issue... updating to 0.90.10  
solved it for me.

I think I got an older version by using `brew install`, but  
download/installation directly from the website is super  
easy: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/download/)

On Friday, November 22, 2013 4:37:40 AM UTC-5, paul wrote:

> hi Alex i tried as suggested but it seams i am still missing something ,  
> when i tried the query below i still get No query registered for  
> [function\_score]] exception
> 
> {  
> "query": {  
> "function\_score": {  
> "functions": [  
> {  
> "DECAY\_FUNCTION": {  
> "Tution": {  
> "reference": "10000",  
> "scale": "5000"  
> }  
> }  
> }  
> ],  
> "query": {  
> "match": {  
> "programs": "computer science"  
> }  
> },  
> "score\_mode": "multiply"  
> }  
> }  
> }
> 
> On Friday, 22 November 2013 14:04:49 UTC+5:30, Alexander Reelsen wrote:
> 
> > Hey,
> > 
> > you need to use one of the score functions mentioned in  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html#_score_functions)[http://www.google.com/url?q=http%3A%2F%2Fwww.elasticsearch.org%2Fguide%2Fen%2Felasticsearch%2Freference%2Fcurrent%2Fquery-dsl-function-score-query.html%23\_score\_functions&sa=D&sntz=1&usg=AFQjCNFBAPkmuOAra99m7KO\_A6OltCBZoQ](http://www.google.com/url?q=http%3A%2F%2Fwww.elasticsearch.org%2Fguide%2Fen%2Felasticsearch%2Freference%2Fcurrent%2Fquery-dsl-function-score-query.html%23_score_functions&sa=D&sntz=1&usg=AFQjCNFBAPkmuOAra99m7KO_A6OltCBZoQ)
> > 
> > So either script\_score, boost factor, random or one of the decay  
> > functions.. the error message is also telling you not to forget the query  
> > field inside of the function score.
> > 
> > --Alex
> > 
> > On Fri, Nov 22, 2013 at 9:31 AM, paul [avinas...@gmail.com](mailto:avinas...@gmail.com) wrote:
> > 
> > > What should be defined inside the function , any example queries. could  
> > > not find one on Elasticsearch page.this throws a exception No query  
> > > registered for [function\_score]]  
> > > {  
> > > "query":{  
> > > "function\_score":{  
> > > "query":{  
> > > "match":{  
> > > "programs":"computer science"  
> > > }  
> > > },  
> > > "functions":[  
> > > {  
> > > "filter":{  
> > > "range":{  
> > > "tution":{  
> > > "from":10000,  
> > > "to":20000  
> > > }  
> > > }  
> > > },  
> > > "FUNCTION":{  
> > > "boost": "3"  
> > > }  
> > > }  
> > > ],  
> > > "score\_mode":"avg",  
> > > "boost\_mode":"avg"  
> > > }  
> > > }  
> > > }
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/69eb1edd-ab2a-47d6-92dd-cb20e6b70116%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/69eb1edd-ab2a-47d6-92dd-cb20e6b70116%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![paul1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul1/32/46819_2.png) [@paul1](https://discuss.elastic.co/u/paul1)\
**Post date:** [January 14, 2014, 6:50am UTC](https://discuss.elastic.co/t/function-score/14538/6 "2014-01-14T06:50:31Z")

</div>

thank you william will try upgrading

-paul

On Tue, Jan 14, 2014 at 4:23 AM, William Goldstein \<  
[williamrgoldstein@gmail.com](mailto:williamrgoldstein@gmail.com)\> wrote:

> Hey I realize this is an old thread, but just in case anyone else has this  
> problem, it's almost definitely a versioning issue... updating to 0.90.10  
> solved it for me.
> 
> I think I got an older version by using `brew install`, but  
> download/installation directly from the website is super easy:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/download/)
> 
> On Friday, November 22, 2013 4:37:40 AM UTC-5, paul wrote:
> 
> > hi Alex i tried as suggested but it seams i am still missing something ,  
> > when i tried the query below i still get No query registered for  
> > [function\_score]] exception
> > 
> > {  
> > "query": {  
> > "function\_score": {  
> > "functions": [  
> > {  
> > "DECAY\_FUNCTION": {  
> > "Tution": {  
> > "reference": "10000",  
> > "scale": "5000"  
> > }  
> > }  
> > }  
> > ],  
> > "query": {  
> > "match": {  
> > "programs": "computer science"  
> > }  
> > },  
> > "score\_mode": "multiply"  
> > }  
> > }  
> > }
> > 
> > On Friday, 22 November 2013 14:04:49 UTC+5:30, Alexander Reelsen wrote:
> > 
> > > Hey,
> > > 
> > > you need to use one of the score functions mentioned in  
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/)  
> > > reference/current/query-dsl-function-score-query.html#\_score\_functions[http://www.google.com/url?q=http%3A%2F%2Fwww.elasticsearch.org%2Fguide%2Fen%2Felasticsearch%2Freference%2Fcurrent%2Fquery-dsl-function-score-query.html%23\_score\_functions&sa=D&sntz=1&usg=AFQjCNFBAPkmuOAra99m7KO\_A6OltCBZoQ](http://www.google.com/url?q=http%3A%2F%2Fwww.elasticsearch.org%2Fguide%2Fen%2Felasticsearch%2Freference%2Fcurrent%2Fquery-dsl-function-score-query.html%23_score_functions&sa=D&sntz=1&usg=AFQjCNFBAPkmuOAra99m7KO_A6OltCBZoQ)
> > > 
> > > So either script\_score, boost factor, random or one of the decay  
> > > functions.. the error message is also telling you not to forget the query  
> > > field inside of the function score.
> > > 
> > > --Alex
> > > 
> > > On Fri, Nov 22, 2013 at 9:31 AM, paul [avinas...@gmail.com](mailto:avinas...@gmail.com) wrote:
> > > 
> > > > What should be defined inside the function , any example queries. could  
> > > > not find one on Elasticsearch page.this throws a exception No query  
> > > > registered for [function\_score]]  
> > > > {  
> > > > "query":{  
> > > > "function\_score":{  
> > > > "query":{  
> > > > "match":{  
> > > > "programs":"computer science"  
> > > > }  
> > > > },  
> > > > "functions":[  
> > > > {  
> > > > "filter":{  
> > > > "range":{  
> > > > "tution":{  
> > > > "from":10000,  
> > > > "to":20000  
> > > > }  
> > > > }  
> > > > },  
> > > > "FUNCTION":{  
> > > > "boost": "3"  
> > > > }  
> > > > }  
> > > > ],  
> > > > "score\_mode":"avg",  
> > > > "boost\_mode":"avg"  
> > > > }  
> > > > }  
> > > > }
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to the Google  
> > > > Groups "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/ZGjv6eCBKXs/unsubscribe](https://groups.google.com/d/topic/elasticsearch/ZGjv6eCBKXs/unsubscribe).  
> > > To unsubscribe from this group and all its topics, send an email to  
> > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/69eb1edd-ab2a-47d6-92dd-cb20e6b70116%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/69eb1edd-ab2a-47d6-92dd-cb20e6b70116%40googlegroups.com)  
> > > .
> 
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAO066G0iRsSxqQPtfJ2j4sJHM7uVS2yb9bK-dHgv5dQDWNLxig%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAO066G0iRsSxqQPtfJ2j4sJHM7uVS2yb9bK-dHgv5dQDWNLxig%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [July 6, 2017, 1:57am UTC](https://discuss.elastic.co/t/function-score/14538/7 "2017-07-06T01:57:03Z")

</div>


