# Elasticsearch function\_score with nested\_objects

**URL:** <https://discuss.elastic.co/t/elasticsearch-function-score-with-nested-objects/19137>\
**Category:** Elasticsearch\
**Created:** [August 7, 2014, 2:17pm UTC](https://discuss.elastic.co/t/elasticsearch-function-score-with-nested-objects/19137 "2014-08-07T14:17:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fabian\_Kostring](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fabian_kostring/32/1310_2.png) [@Fabian\_Kostring](https://discuss.elastic.co/u/Fabian_Kostring)\
**Post date:** [August 7, 2014, 2:17pm UTC](https://discuss.elastic.co/t/elasticsearch-function-score-with-nested-objects/19137/1 "2014-08-07T14:17:03Z")

</div>

I have a problem with a query.I used a query for boosting documents with no  
nested\_objects. Now i use nested\_objects and changed the query to use a  
nested filter but nothing is boosted. I get the documents i expected but  
with no \_score changes.

Am i doing something wrong?

GET index/type/\_search  
{  
"query": {  
"function\_score": {  
"filter": {  
"bool": {  
"must": [  
{  
"term": {  
"parent.child": "test"  
}  
}  
]  
}  
},  
"functions": [  
{  
"boost\_factor": "100",  
"filter": {  
"nested": {  
"path": "parent",  
"filter": {  
"bool": {  
"must": [  
{  
"term": {  
"child": "test"  
}  
}  
]  
}  
}  
}  
}  
}  
],  
"score\_mode": "sum"  
}  
},  
"sort": "\_score",  
"from": 0,  
"size": 320  
}

Or is it because of

A nested filter behaves much like a nested query, except that it doesn’t

> > accept the score\_mode parameter. It can only be used in “filter context” —  
> > such as inside a filtered query — and it behaves like any other filter: it  
> > includes or excludes, but it doesn’t score.
> 
> > While the results of the nested filter itself are not cached, the usual  
> > caching rules apply to the filter inside the nested filter.

> **[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.

Thanks

--  
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/e7eae68f-c8ba-4763-b564-3b530d088033%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e7eae68f-c8ba-4763-b564-3b530d088033%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:10am UTC](https://discuss.elastic.co/t/elasticsearch-function-score-with-nested-objects/19137/2 "2017-07-06T01:10:09Z")

</div>


