Allow fields calculated by scripting at index time #68984
Labels
>enhancement
Meta
release highlight
:Search Foundations/Mapping
Index mappings, including merging and defining field types
Team:Search Foundations
Meta label for the Search Foundations team in Elasticsearch
v7.13.0
Uh oh!
There was an error while loading. Please reload this page.
Runtime fields allow you to create a synthetic field derived from the values of other document properties at query time, which prioritises flexibility (you can change these fields at any time) over speed. This issue will address generating these synthetic fields at index time, trading off some of that flexibility for better query performance.
There should be as little impedance mismatch as possible between the scripts used for runtime fields and those used for index time calculations. Ideally, making a runtime field indexed should be as simple as moving the field definition from the runtime section of mappings into the properties section, eg:
becomes:
In particular, we will need to reproduce the typed
emit
functions currently used by runtime scripts, and make_doc
,_source
and_fields
available in the same way (although_fields
is probably not a priority here as it essentially duplicates_source
at index time).Now that runtime fields have been moved to core, we can re-use their script factory implementations by mocking a lucene LeafReader over the contents of the parsed lucene Document that is to be indexed.
The steps to take are anticipated to be:
_source
(from the index request bytes) and_doc
(from mappings and value fetchers built against the same lookup) to scripts (Add calculated numeric fields #69531)script
parameter for each of the mapping types currently built for runtime fieldsThe text was updated successfully, but these errors were encountered: