<p dir="auto">Currently the scripting API allows to return arbitrary objects. This is an issue for search scripts because they might be called billions of times in a single search request and missing information about the return type makes things harder to optimize.</p>
<p dir="auto">So we could look into specializing the search script API so that it would only be allowed to return a double. This would break a couple of things however:</p>
<ul dir="auto">
<li>scripts would not be able to return multiple values per document anymore,</li>
<li>scripts would not be able to return anything else than a double, so eg. building a string in a script and returning it would be impossible.</li>
</ul>
<p dir="auto">This is likely not an issue for the main use cases that we want to support with scripting, such as multiplying the score with the log of the value of some field. However I wolud not be surprised that there are some existing search scripts producing arrays of numbers or strings in the wild.</p>
<p dir="auto">I get 'T'/'F' and also 't' terms for a boolean field, leading to problems when filtering on the field. The below gist reproduces this:-</p>
<p dir="auto"><a href="https://gist.github.com/4284891">https://gist.github.com/4284891</a></p>
<p dir="auto">This is on elasticsearch 0.20.1, a quick check on 0.19.10 and I can't reproduce this.</p>