Skip to content

Can search script avoid hashtable lookups for field access? #25913

@jpountz

Description

@jpountz

Take this search script: Math.abs(doc['field'].value). On every document, we will call LeafDocLookup.get which mostly fetches script doc values for the field field in a hashtable and advances it to the current document. The hashtable lookup feels a bit unnecessary since we will always return the same ScriptDocValues object on a per-segment basis, is there a way we could avoid it? A hashtable lookup may look lightweight, but when everything that you do in your script is reading a doc value and applying a cheap function like Math.abs, it might not be negligible?

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions