ElasticsearchParseException/NumberFormatException in scale/offset of decay function scoring

Per the documentation for decay functions, I'm using the Date Format specified - e.g., 1M for 1 month, 1y for 1 year...

I'm getting parse exceptions due to number format exception except for d for day and w for week. Why is this?

function score query with linear decay function?

https://github.com/elastic/elasticsearch/blob/master/core/src/test/java/org/elasticsearch/search/functionscore/DecayFunctionScoreTests.java#L615

what's your query code?

Using exponential decay - code is as follows (we've templated our queries with handlebars), and I'm getting the NumberFormatException on 1.5y (or 1y when I tried that) and 1M - 365d worked and 5w worked, lowercase m worked as well but it's unclear if that's minutes as it should be per the Date Format documentation or if it's months:

"exp" : {
        "{{FIELD_UPLOAD_DATE}}" : {
            "scale" : "1.5y",
            "offset" : "1M",
            "decay" : {{recencyDecay}}
        }
    }

the units supported are y (year), M (month), w (week), d (day), h (hour), m (minute), and s (second).

Thank you for confirming that. However, when I use y or M, I get a NumberFormatException, and I'm running on version 1.4.2:

! ]]]; **nested: ElasticsearchParseException[Failed to parse [1y]]; nested: NumberFormatException

! ]]]; nested: ElasticsearchParseException[Failed to parse [1M]]; nested: NumberFormatException[For input string: "1M"]; }

1 Like