Accessing unindexed fields in script_score

Does accessing fields that are not indexed in script_score imposes extra time penalty? In other words, should I index all the fields that my script access, even if they are not queried?

Sample part of my schema:
    "likes": {"type": "integer, "indexed": false}

A sample script:

return Math.log(doc['likes'].value)

Also I want to know if the time spent in accessing document fields adds up to fetch time or they are part of the query time (which are reported by index/_stats api).


A script_score is part of the query time. Accessing fields through doc is as fast as can be done. This is separate from whether the field is indexed, in a separate data structure in Lucene.

1 Like

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