# Boosting result documents that have a certain key-value combination in a nested strucutre

**URL:** <https://discuss.elastic.co/t/boosting-result-documents-that-have-a-certain-key-value-combination-in-a-nested-strucutre/16333>\
**Category:** Elasticsearch\
**Created:** [March 12, 2014, 7:52pm UTC](https://discuss.elastic.co/t/boosting-result-documents-that-have-a-certain-key-value-combination-in-a-nested-strucutre/16333 "2014-03-12T19:52:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Schlenzka](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael_schlenzka/32/1731_2.png) [@Michael\_Schlenzka](https://discuss.elastic.co/u/Michael_Schlenzka)\
**Post date:** [March 12, 2014, 7:52pm UTC](https://discuss.elastic.co/t/boosting-result-documents-that-have-a-certain-key-value-combination-in-a-nested-strucutre/16333/1 "2014-03-12T19:52:31Z")

</div>

Hi all,

I want to boost documents that have a certain property in a nested  
structure (see mapping) with the corresponding value in the nested  
structure.

In the example below i got value pairs of a color and a value. Let's say I  
want to boost all documents of a query, that have the color blue and I want  
to boost it with the corresponding value of blue in each document (so the  
boost should be 1 for doc 1 because the value for blue is 1, 5 for doc 3  
because the value for blue is 5, ...). What would be a good way to do so?#

I was trying to use function\_score or custom\_filters\_score ... but I am  
stuck on accessing the value for a specific color for a specific document  
in mvel. Can someone help me on how to access the the value for boosting?  
Or has a different solution on how to solve my problem?

Indexmapping:

curl -XPOST "[http://localhost:9200/products](http://localhost:9200/products)" -d'  
{  
"mappings" : {  
"product" : {  
"properties" : {  
"title" : { "type" : "string"},  
"uuid" : { "type" : "double"},  
"review" : { "type" : "string"},  
"colors" : {  
"type" : "nested",  
"properties": {  
"color" : { "type" : "string"},  
"value" : {"type" : "integer"}  
}  
}  
}  
}  
}  
}'

Sample Documents:

curl -XPUT "[http://localhost:9200/products/product/1](http://localhost:9200/products/product/1)" -d'  
{  
"title": "1",  
"uuid": "1",  
"review": "test",  
"colors": [{  
"color": "blue",  
"value": 1  
}, {  
"color": "yellow",  
"value": 2  
}, {  
"color": "red",  
"value": 14  
}]  
}'

curl -XPUT "[http://localhost:9200/products/product/2](http://localhost:9200/products/product/2)" -d'  
{  
"title": "2",  
"uuid": "2",  
"review": "test",  
"colors": [{  
"colors": "green",  
"value": 1  
}, {  
"color": "white",  
"value": 2  
}]  
}'

curl -XPUT "[http://localhost:9200/products/product/3](http://localhost:9200/products/product/3)" -d'  
{  
"title": "3",  
"uuid": "3",  
"review": "test",  
"colors": [{  
"color": "blue",  
"value": 5  
}, {  
"color": "green",  
"value": 5  
}]  
}'

curl -XPUT "[http://localhost:9200/products/product/4](http://localhost:9200/products/product/4)" -d'  
{  
"title": "4",  
"uuid": "4",  
"review": "test",  
"colors": [{  
"color": "green",  
"value": 0  
}, {  
"color": "blue",  
"value": 0  
}, {  
"color": "red",  
"value": 0  
}, {  
"color": "white",  
"value": 0  
}]  
}'

curl -XPUT "[http://localhost:9200/products/product/5](http://localhost:9200/products/product/5)" -d'  
{  
"title": "5",  
"uuid": "5",  
"review": "test"  
}'

Query using function\_score - problem is that I am unable to access the  
value of the corresponding color.

curl -XGET "[http://localhost:9200/products/product/\_search?pretty=true](http://localhost:9200/products/product/_search?pretty=true)" -d'  
{  
"query" : {  
"function\_score": {  
"boost\_mode" : "replace",  
"query": {  
"match" : { "review" : "test"}  
},  
"boost" : "2",  
"functions": [  
{  
"filter": {  
"nested": {  
"path": "colors",  
"filter": {  
"term" :  
{"colors.color" : "blue"}  
}  
}  
},  
"script\_score" : {  
"script" : "\_score + doc["value"].value"  
}  
},  
{  
"script\_score" : {  
"script" : "\_score"  
}  
}  
],  
"score\_mode" : "first"  
}  
}  
}'

Or I could use custom\_filters\_score - but then again - how do I get the  
value of the corresponding color?

curl -XGET "[http://localhost:9200/products/product/\_search?pretty=true](http://localhost:9200/products/product/_search?pretty=true)" -d'  
{  
"query" : {  
"custom\_filters\_score": {  
"query": {  
"match" : { "review" : "test"}  
},  
"filters": [  
{  
"filter": {  
"nested": {  
"path": "colors",  
"filter": {  
"term" :  
{"colors.color" : "blue"}  
}  
}  
},  
"boost" : 2  
}],  
"score\_mode" : "max"  
}  
}  
}'

--  
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/8f24d4b0-29a5-43df-b46a-1103c7d0a6bf%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8f24d4b0-29a5-43df-b46a-1103c7d0a6bf%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [March 12, 2014, 8:46pm UTC](https://discuss.elastic.co/t/boosting-result-documents-that-have-a-certain-key-value-combination-in-a-nested-strucutre/16333/2 "2014-03-12T20:46:06Z")

</div>

Hiya Michael

The problem with your current attempts is that the nested filter matches on  
the color "blue", but then returns the PARENT document, so when you try to  
access the colors.value field it is not available.

Instead, you need to run a nested filter, and return the sum of the  
colors.value field as the score:

curl -XGET "[http://localhost:9200/products/product/\_search?pretty=true](http://localhost:9200/products/product/_search?pretty=true)" -d'  
{  
"query": {  
"bool": {  
"disable\_coord": true,  
"must": {  
"match": {  
"review": "test"  
}  
},  
"should": {  
"nested": {  
"path": "colors",  
"query": {  
"function\_score": {  
"score\_mode": "sum",  
"query": {  
"term": {  
"colors.color": "blue"  
}  
},  
"script\_score": {  
"script": "doc["value"].value"  
}  
}  
}  
}  
}  
}  
}  
}'

clint

On 12 March 2014 20:52, Michael Schlenzka [michael@schlenzka.com](mailto:michael@schlenzka.com) wrote:

> Hi all,
> 
> I want to boost documents that have a certain property in a nested  
> structure (see mapping) with the corresponding value in the nested  
> structure.
> 
> In the example below i got value pairs of a color and a value. Let's say I  
> want to boost all documents of a query, that have the color blue and I want  
> to boost it with the corresponding value of blue in each document (so the  
> boost should be 1 for doc 1 because the value for blue is 1, 5 for doc 3  
> because the value for blue is 5, ...). What would be a good way to do so?#
> 
> I was trying to use function\_score or custom\_filters\_score ... but I am  
> stuck on accessing the value for a specific color for a specific document  
> in mvel. Can someone help me on how to access the the value for boosting?  
> Or has a different solution on how to solve my problem?
> 
> Indexmapping:
> 
> curl -XPOST "[http://localhost:9200/products](http://localhost:9200/products)" -d'  
> {  
> "mappings" : {  
> "product" : {  
> "properties" : {  
> "title" : { "type" : "string"},  
> "uuid" : { "type" : "double"},  
> "review" : { "type" : "string"},  
> "colors" : {  
> "type" : "nested",  
> "properties": {  
> "color" : { "type" : "string"},  
> "value" : {"type" : "integer"}  
> }  
> }  
> }  
> }  
> }  
> }'
> 
> Sample Documents:
> 
> curl -XPUT "[http://localhost:9200/products/product/1](http://localhost:9200/products/product/1)" -d'  
> {  
> "title": "1",  
> "uuid": "1",  
> "review": "test",  
> "colors": [{  
> "color": "blue",  
> "value": 1  
> }, {  
> "color": "yellow",  
> "value": 2  
> }, {  
> "color": "red",  
> "value": 14  
> }]  
> }'
> 
> curl -XPUT "[http://localhost:9200/products/product/2](http://localhost:9200/products/product/2)" -d'  
> {  
> "title": "2",  
> "uuid": "2",  
> "review": "test",  
> "colors": [{  
> "colors": "green",  
> "value": 1  
> }, {  
> "color": "white",  
> "value": 2  
> }]  
> }'
> 
> curl -XPUT "[http://localhost:9200/products/product/3](http://localhost:9200/products/product/3)" -d'  
> {  
> "title": "3",  
> "uuid": "3",  
> "review": "test",  
> "colors": [{  
> "color": "blue",  
> "value": 5  
> }, {  
> "color": "green",  
> "value": 5  
> }]  
> }'
> 
> curl -XPUT "[http://localhost:9200/products/product/4](http://localhost:9200/products/product/4)" -d'  
> {  
> "title": "4",  
> "uuid": "4",  
> "review": "test",  
> "colors": [{  
> "color": "green",  
> "value": 0  
> }, {  
> "color": "blue",  
> "value": 0  
> }, {  
> "color": "red",  
> "value": 0  
> }, {  
> "color": "white",  
> "value": 0  
> }]  
> }'
> 
> curl -XPUT "[http://localhost:9200/products/product/5](http://localhost:9200/products/product/5)" -d'  
> {  
> "title": "5",  
> "uuid": "5",  
> "review": "test"  
> }'
> 
> Query using function\_score - problem is that I am unable to access the  
> value of the corresponding color.
> 
> curl -XGET "[http://localhost:9200/products/product/\_search?pretty=true](http://localhost:9200/products/product/_search?pretty=true)"  
> -d'  
> {  
> "query" : {  
> "function\_score": {  
> "boost\_mode" : "replace",  
> "query": {  
> "match" : { "review" : "test"}  
> },  
> "boost" : "2",  
> "functions": [  
> {  
> "filter": {  
> "nested": {  
> "path": "colors",  
> "filter": {  
> "term" :  
> {"colors.color" : "blue"}  
> }  
> }  
> },  
> "script\_score" : {  
> "script" : "\_score + doc["value"].value"  
> }  
> },  
> {  
> "script\_score" : {  
> "script" : "\_score"  
> }  
> }  
> ],  
> "score\_mode" : "first"  
> }  
> }  
> }'
> 
> Or I could use custom\_filters\_score - but then again - how do I get the  
> value of the corresponding color?
> 
> curl -XGET "[http://localhost:9200/products/product/\_search?pretty=true](http://localhost:9200/products/product/_search?pretty=true)"  
> -d'  
> {  
> "query" : {  
> "custom\_filters\_score": {  
> "query": {  
> "match" : { "review" : "test"}  
> },  
> "filters": [  
> {  
> "filter": {  
> "nested": {  
> "path": "colors",  
> "filter": {  
> "term" :  
> {"colors.color" : "blue"}  
> }  
> }  
> },  
> "boost" : 2  
> }],  
> "score\_mode" : "max"  
> }  
> }  
> }'
> 
> --  
> 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/8f24d4b0-29a5-43df-b46a-1103c7d0a6bf%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8f24d4b0-29a5-43df-b46a-1103c7d0a6bf%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/8f24d4b0-29a5-43df-b46a-1103c7d0a6bf%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/8f24d4b0-29a5-43df-b46a-1103c7d0a6bf%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CAPt3XKTwQRc3msPw9f9QyODLYfOeb%2B-vryyG4iTSmmdmUrxsPg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPt3XKTwQRc3msPw9f9QyODLYfOeb%2B-vryyG4iTSmmdmUrxsPg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Michael\_Schlenzka](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael_schlenzka/32/1731_2.png) [@Michael\_Schlenzka](https://discuss.elastic.co/u/Michael_Schlenzka)\
**Post date:** [March 12, 2014, 10:32pm UTC](https://discuss.elastic.co/t/boosting-result-documents-that-have-a-certain-key-value-combination-in-a-nested-strucutre/16333/3 "2014-03-12T22:32:20Z")

</div>

Hello Clinton,

Thank you for your answer. Probably didn't describe it that clear, I do not  
want the sum of all the values of the key-value-pairs. I want to boost each  
document (with a specific key) only with the value for the matching  
key/color (e.g. if searching for documents with blue as color each document  
should be boosted with the value for blue in this document. Am I correct,  
that the sum will give me the sum of all values in the nested value fields  
as score/boost? Is the solution to write a script in mvel that iterates  
through the nested fields?

Regards

Michael

--  
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/8aae16d5-542a-4fa6-9ade-98b3e81ca0d2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8aae16d5-542a-4fa6-9ade-98b3e81ca0d2%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [March 13, 2014, 9:21am UTC](https://discuss.elastic.co/t/boosting-result-documents-that-have-a-certain-key-value-combination-in-a-nested-strucutre/16333/4 "2014-03-13T09:21:37Z")

</div>

On 12 March 2014 23:32, Michael Schlenzka [michael@schlenzka.com](mailto:michael@schlenzka.com) wrote:

> I do not want the sum of all the values of the key-value-pairs. I want to  
> boost each document (with a specific key) only with the value for the  
> matching key/color (e.g. if searching for documents with blue as color each  
> document should be boosted with the value for blue in this document. Am I  
> correct, that the sum will give me the sum of all values in the nested  
> value fields as score/boost?

This is exactly what my query achieves. The nested query matches nested  
docs which have color=blue, and adds up the value for just those docs. It  
returns this sum as the \_score from that query.

The bool query then adds the \_score from the nested query to the \_score  
from the review=test query and returns that as the overall \_score per doc.

--  
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/CAPt3XKRJx9L2izFf1csZmdzce\_oSSzcRDW1kttkhkARSEW%3D2YQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPt3XKRJx9L2izFf1csZmdzce_oSSzcRDW1kttkhkARSEW%3D2YQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [March 13, 2014, 10:35am UTC](https://discuss.elastic.co/t/boosting-result-documents-that-have-a-certain-key-value-combination-in-a-nested-strucutre/16333/5 "2014-03-13T10:35:25Z")

</div>

Have you tried term boosting?

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

Jörg

On Wed, Mar 12, 2014 at 8:52 PM, Michael Schlenzka [michael@schlenzka.com](mailto:michael@schlenzka.com)wrote:

> Hi all,
> 
> I want to boost documents that have a certain property in a nested  
> structure (see mapping) with the corresponding value in the nested  
> structure.
> 
> In the example below i got value pairs of a color and a value. Let's say I  
> want to boost all documents of a query, that have the color blue and I want  
> to boost it with the corresponding value of blue in each document (so the  
> boost should be 1 for doc 1 because the value for blue is 1, 5 for doc 3  
> because the value for blue is 5, ...). What would be a good way to do so?#
> 
> I was trying to use function\_score or custom\_filters\_score ... but I am  
> stuck on accessing the value for a specific color for a specific document  
> in mvel. Can someone help me on how to access the the value for boosting?  
> Or has a different solution on how to solve my problem?
> 
> Indexmapping:
> 
> curl -XPOST "[http://localhost:9200/products](http://localhost:9200/products)" -d'  
> {  
> "mappings" : {  
> "product" : {  
> "properties" : {  
> "title" : { "type" : "string"},  
> "uuid" : { "type" : "double"},  
> "review" : { "type" : "string"},  
> "colors" : {  
> "type" : "nested",  
> "properties": {  
> "color" : { "type" : "string"},  
> "value" : {"type" : "integer"}  
> }  
> }  
> }  
> }  
> }  
> }'
> 
> Sample Documents:
> 
> curl -XPUT "[http://localhost:9200/products/product/1](http://localhost:9200/products/product/1)" -d'  
> {  
> "title": "1",  
> "uuid": "1",  
> "review": "test",  
> "colors": [{  
> "color": "blue",  
> "value": 1  
> }, {  
> "color": "yellow",  
> "value": 2  
> }, {  
> "color": "red",  
> "value": 14  
> }]  
> }'
> 
> curl -XPUT "[http://localhost:9200/products/product/2](http://localhost:9200/products/product/2)" -d'  
> {  
> "title": "2",  
> "uuid": "2",  
> "review": "test",  
> "colors": [{  
> "colors": "green",  
> "value": 1  
> }, {  
> "color": "white",  
> "value": 2  
> }]  
> }'
> 
> curl -XPUT "[http://localhost:9200/products/product/3](http://localhost:9200/products/product/3)" -d'  
> {  
> "title": "3",  
> "uuid": "3",  
> "review": "test",  
> "colors": [{  
> "color": "blue",  
> "value": 5  
> }, {  
> "color": "green",  
> "value": 5  
> }]  
> }'
> 
> curl -XPUT "[http://localhost:9200/products/product/4](http://localhost:9200/products/product/4)" -d'  
> {  
> "title": "4",  
> "uuid": "4",  
> "review": "test",  
> "colors": [{  
> "color": "green",  
> "value": 0  
> }, {  
> "color": "blue",  
> "value": 0  
> }, {  
> "color": "red",  
> "value": 0  
> }, {  
> "color": "white",  
> "value": 0  
> }]  
> }'
> 
> curl -XPUT "[http://localhost:9200/products/product/5](http://localhost:9200/products/product/5)" -d'  
> {  
> "title": "5",  
> "uuid": "5",  
> "review": "test"  
> }'
> 
> Query using function\_score - problem is that I am unable to access the  
> value of the corresponding color.
> 
> curl -XGET "[http://localhost:9200/products/product/\_search?pretty=true](http://localhost:9200/products/product/_search?pretty=true)"  
> -d'  
> {  
> "query" : {  
> "function\_score": {  
> "boost\_mode" : "replace",  
> "query": {  
> "match" : { "review" : "test"}  
> },  
> "boost" : "2",  
> "functions": [  
> {  
> "filter": {  
> "nested": {  
> "path": "colors",  
> "filter": {  
> "term" :  
> {"colors.color" : "blue"}  
> }  
> }  
> },  
> "script\_score" : {  
> "script" : "\_score + doc["value"].value"  
> }  
> },  
> {  
> "script\_score" : {  
> "script" : "\_score"  
> }  
> }  
> ],  
> "score\_mode" : "first"  
> }  
> }  
> }'
> 
> Or I could use custom\_filters\_score - but then again - how do I get the  
> value of the corresponding color?
> 
> curl -XGET "[http://localhost:9200/products/product/\_search?pretty=true](http://localhost:9200/products/product/_search?pretty=true)"  
> -d'  
> {  
> "query" : {  
> "custom\_filters\_score": {  
> "query": {  
> "match" : { "review" : "test"}  
> },  
> "filters": [  
> {  
> "filter": {  
> "nested": {  
> "path": "colors",  
> "filter": {  
> "term" :  
> {"colors.color" : "blue"}  
> }  
> }  
> },  
> "boost" : 2  
> }],  
> "score\_mode" : "max"  
> }  
> }  
> }'
> 
> --  
> 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/8f24d4b0-29a5-43df-b46a-1103c7d0a6bf%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8f24d4b0-29a5-43df-b46a-1103c7d0a6bf%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/8f24d4b0-29a5-43df-b46a-1103c7d0a6bf%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/8f24d4b0-29a5-43df-b46a-1103c7d0a6bf%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CAKdsXoHrqPvHfCrjZ0tyTRwXeF7eEN%3DhrG57b8nd36%2Be4jMHVg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHrqPvHfCrjZ0tyTRwXeF7eEN%3DhrG57b8nd36%2Be4jMHVg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [March 13, 2014, 10:59am UTC](https://discuss.elastic.co/t/boosting-result-documents-that-have-a-certain-key-value-combination-in-a-nested-strucutre/16333/6 "2014-03-13T10:59:48Z")

</div>

On 13 March 2014 11:35, [joergprante@gmail.com](mailto:joergprante@gmail.com) [joergprante@gmail.com](mailto:joergprante@gmail.com) wrote:

> Have you tried term boosting?
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_boosting)

This won't help him boost by the value in the value field associated with  
each color=blue nested document.

--  
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/CAPt3XKRXcgtaAwvYjscO4ByHpJUXkjzMVPCZua6Y2j\_m-MUovQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPt3XKRXcgtaAwvYjscO4ByHpJUXkjzMVPCZua6Y2j_m-MUovQ%40mail.gmail.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:43am UTC](https://discuss.elastic.co/t/boosting-result-documents-that-have-a-certain-key-value-combination-in-a-nested-strucutre/16333/7 "2017-07-06T01:43:30Z")

</div>


