Function score weight rounding score If value is high

Hello,

We have function scores and functions which manipulate scores by some filters etc. We set one of the function score weight as high numbers because of the our business. Also we need fraction of the value to be able to sort documents correctly but we see that weight value is taking eight digits therefore other fractions rounding.

see below example;

        {
          "function_score": {
            "boost_mode": "replace",
            "functions": [
              {
                "filter": {},
                "weight": 200000.9587
              },
              {}
            ],
            "query": {},
            "score_mode": "sum"
          }
        }

this will give us _score" : 200000.95

As you decrease the value of the weight, the fraction increases. Like;

        {
          "function_score": {
            "boost_mode": "replace",
            "functions": [
              {
                "filter": {},
                "weight": 200.9587567
              },
              {}
            ],
            "query": {},
            "score_mode": "sum"
          }
        }

this will give us _score" : 200.95876

Our need is value should be millions (like 2000000) and we need 4 | 5 digit fractions as well.

What can we do?

Thanks.

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.