The traditional script_fields can be used only on the last stage of a search request – fetch phase, which happens after we have already selected top N hits based on some query, and would like to decorate those hits with some extra information by adding extra script fields to those hits.
Runtime fields are much more powerful. Unlike traditional script_fields, you can use them in the query phase of a search request to select docs based on them or use their values in aggs. For example, you can define a new runtime field, and write a query that will select documents based on this new defined field.
Another example, you can define a new runtime field, and run an aggregation based on it.
These examples are something you can't do with a traditional script_fields.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.