Using function_score in Kibana 4 search

I am trying to use function_score in a Kibana 4 search. The query I am issuing is:


I tried to write it in the query bar and also in the advanced query editor (Edit Saved Objects).

I get the following error:

The mapping of the field "purchases" is:

"purchases": { "type" : "long" }

What am I doing wrong?