Runtime field scoring with decay

Hi,

I've been facing an issue regarding runtime fields scoring using decay functions. Let me share a snippet of my code for the refrence:

Runtime Field

"runtime_mappings": {
        "price": {
            "type": "double",
            "script": {
                "source":''
            }
         }
    }

And this is a decay function for score calculation:

"functions": [
                {
                    "linear": {
                        "price": {
                            "origin": "150.00",
                            "scale": 10,
                            "offset": "50.00",
                            "decay": 0.75
                        }
                    }
                }
            ],

Now the thing is, when I search price:

"must": [
                        {
                            "range": {
                                "price": {
                                    "gte": "100.00",
                                    "lte": "200.00"
                                }
                            }
                        }
                    ]

It gives me an error that

UnhandledPromiseRejectionWarning: Error: [parsing_exception] field [price] is of type [org.elasticsearch.index.mapper.DoubleScriptFieldType@74647e76], but only numeric types are supported., with { line=1 & col=1 }

Can anyone help me in this. Because I find that there is an incompatibility of datatypes. How can we handle this issue ?

Thanks in Advance.

wild guess here: maybe putting the gte and lte values in quotes instead of using numbers is the issue here.

Otherwise, please provide a fully reproducible issue, otherwise it is hard to put the things together in the same way you did.

Thanks!

Hi @spinscale, Firstly thanks for taking a time to look into the issue. What other details you want to reproduce the issue ?