Is root document _boost null_value broken?


(James Wilson) #1

I tried the following:

curl -XDELETE http://localhost:9200/twitter/foo/_mapping
curl -XDELETE http://localhost:9200/twitter/bar/_mapping

curl -XPUT 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 -d '{"bar":
{"properties" : {"message": {"type": "string" } } } }'

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

curl -XGET '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?


(Shay Banon) #2

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 wrote:

I tried the following:

curl -XDELETE http://localhost:9200/twitter/foo/_mapping
curl -XDELETE http://localhost:9200/twitter/bar/_mapping

curl -XPUT 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 -d '{"bar":
{"properties" : {"message": {"type": "string" } } } }'

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

curl -XGET '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?


(system) #3