# Is root document \_boost null\_value broken?

**URL:** <https://discuss.elastic.co/t/is-root-document--boost-null-value-broken/5634>\
**Category:** Elasticsearch\
**Created:** [October 18, 2011, 8:35pm UTC](https://discuss.elastic.co/t/is-root-document--boost-null-value-broken/5634 "2011-10-18T20:35:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Wilson](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@James\_Wilson](https://discuss.elastic.co/u/James_Wilson)\
**Post date:** [October 18, 2011, 8:35pm UTC](https://discuss.elastic.co/t/is-root-document--boost-null-value-broken/5634/1 "2011-10-18T20:35:45Z")

</div>

I tried the following:

curl -XDELETE [http://localhost:9200/twitter/foo/\_mapping](http://localhost:9200/twitter/foo/_mapping)  
curl -XDELETE [http://localhost:9200/twitter/bar/\_mapping](http://localhost:9200/twitter/bar/_mapping)

curl -XPUT [http://localhost:9200/twitter/foo/\_mapping](http://localhost:9200/twitter/foo/_mapping) -d '{"foo":  
{"\_boost": {"null\_value": 1.5}, "properties" : {"message": {"type":  
"string" } } } }'  
curl -XPUT [http://localhost:9200/twitter/bar/\_mapping](http://localhost:9200/twitter/bar/_mapping) -d '{"bar":  
{"properties" : {"message": {"type": "string" } } } }'

curl -XPUT [http://localhost:9200/twitter/foo/1](http://localhost:9200/twitter/foo/1) -d '{"message": "hello  
world"}'  
curl -XPUT [http://localhost:9200/twitter/bar/1](http://localhost:9200/twitter/bar/1) -d '{"message": "hello  
world"}'

curl -XGET '[http://localhost:9200/twitter/\_search?q=hello&pretty=1](http://localhost:9200/twitter/_search?q=hello&pretty=1)'

I'd expect the result of type foo to have a higher score, but both  
results have the same score. Shouldn't the null\_value be used to  
automatically boost the document of type foo, or am I doing something  
wrong?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [October 18, 2011, 9:14pm UTC](https://discuss.elastic.co/t/is-root-document--boost-null-value-broken/5634/2 "2011-10-18T21:14:22Z")

</div>

Heya,

The `null_value` setting is applied when \_boost exists in the doc, and has  
a null value. It is not applied when \_boost does not exists. So, if you  
added "\_boost" : null to the foo doc, it will work. I guess an option to set  
"default\_value" is possible to add, open an issue?

On Tue, Oct 18, 2011 at 10:35 PM, James Wilson [jwilson556@gmail.com](mailto:jwilson556@gmail.com) wrote:

> I tried the following:
> 
> curl -XDELETE [http://localhost:9200/twitter/foo/\_mapping](http://localhost:9200/twitter/foo/_mapping)  
> curl -XDELETE [http://localhost:9200/twitter/bar/\_mapping](http://localhost:9200/twitter/bar/_mapping)
> 
> curl -XPUT [http://localhost:9200/twitter/foo/\_mapping](http://localhost:9200/twitter/foo/_mapping) -d '{"foo":  
> {"\_boost": {"null\_value": 1.5}, "properties" : {"message": {"type":  
> "string" } } } }'  
> curl -XPUT [http://localhost:9200/twitter/bar/\_mapping](http://localhost:9200/twitter/bar/_mapping) -d '{"bar":  
> {"properties" : {"message": {"type": "string" } } } }'
> 
> curl -XPUT [http://localhost:9200/twitter/foo/1](http://localhost:9200/twitter/foo/1) -d '{"message": "hello  
> world"}'  
> curl -XPUT [http://localhost:9200/twitter/bar/1](http://localhost:9200/twitter/bar/1) -d '{"message": "hello  
> world"}'
> 
> curl -XGET '[http://localhost:9200/twitter/\_search?q=hello&pretty=1](http://localhost:9200/twitter/_search?q=hello&pretty=1)'
> 
> I'd expect the result of type foo to have a higher score, but both  
> results have the same score. Shouldn't the null\_value be used to  
> automatically boost the document of type foo, or am I doing something  
> wrong?

---

<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, 3:51am UTC](https://discuss.elastic.co/t/is-root-document--boost-null-value-broken/5634/3 "2017-07-06T03:51:28Z")

</div>


